You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/08/08 16:51:44 UTC

[superset] 04/11: WIP

This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch db-diagnostics
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 17543b2ae8c7df06a8c4b2f370e9f83e2c659e1d
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Jul 25 14:23:16 2023 -0700

    WIP
---
 superset/cli/test_db.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/superset/cli/test_db.py b/superset/cli/test_db.py
index 9673a85599..30be55bcb9 100644
--- a/superset/cli/test_db.py
+++ b/superset/cli/test_db.py
@@ -278,6 +278,9 @@ def test_sqlalchemy_dialect(
 
 
 def test_database_connectivity(console: Console, engine: Engine) -> None:
+    """
+    Tests the DB API 2.0 driver.
+    """
     with console.status("[bold green]Connecting to database..."):
         try:
             conn = engine.raw_connection()
@@ -287,3 +290,15 @@ def test_database_connectivity(console: Console, engine: Engine) -> None:
             console.print(f":thumbs_down: [red]Failed to connect: {ex}")
             console.print("[bold]Exiting...")
             sys.exit(1)
+
+    cursor = conn.cursor()
+
+    console.print("[bold]Checking that we can run queries...")
+    console.print("sql> SELECT 1;")
+    cursor.execute("SELECT 1")
+    result = cursor.fetchone()[0]
+    color = "green" if result == 1 else "red"
+    console.print(f"[{color}]> {result}")
+
+    # TODO(betodealmeida): create tables with different types and test them
+    # TODO(betodealmeida): run DB-specific tests