You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/12/08 18:18:50 UTC

[superset] 02/02: remove some logs and using ad

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

hugh pushed a commit to branch testing-tunnel
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 53a7df182c23eabdb8d59c80c4d240c89bd55dbe
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Dec 8 13:18:26 2022 -0500

    remove some logs and using ad
---
 superset/databases/commands/create.py          | 5 +----
 superset/databases/commands/test_connection.py | 6 ------
 superset/models/core.py                        | 6 +++---
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/superset/databases/commands/create.py b/superset/databases/commands/create.py
index c5ad3a0f44..aa5c4df766 100644
--- a/superset/databases/commands/create.py
+++ b/superset/databases/commands/create.py
@@ -75,10 +75,6 @@ class CreateDatabaseCommand(BaseCommand):
             ssh_tunnel = None
             import json
 
-            logger.info(
-                "grabbing schemas: %d",
-                json.dumps(self._properties.get("ssh_tunnel", {})),
-            )
             if ssh_tunnel_properties := self._properties.get("ssh_tunnel"):
                 ssh_tunnel = SSHTunnelDAO.create(
                     {
@@ -95,6 +91,7 @@ class CreateDatabaseCommand(BaseCommand):
                     "schema_access", security_manager.get_schema_perm(database, schema)
                 )
 
+            db.session.add(ssh_tunnel)
             db.session.commit()
         except DAOCreateFailedError as ex:
             db.session.rollback()
diff --git a/superset/databases/commands/test_connection.py b/superset/databases/commands/test_connection.py
index 0e4f3e032e..8027efcb49 100644
--- a/superset/databases/commands/test_connection.py
+++ b/superset/databases/commands/test_connection.py
@@ -92,12 +92,6 @@ class TestConnectionDatabaseCommand(BaseCommand):
             database.db_engine_spec.mutate_db_for_connection_test(database)
 
             # Generate tunnel if present in the properties
-            import json
-
-            logger.info(
-                "testing connection: %s",
-                json.dumps(self._properties.get("ssh_tunnel", {})),
-            )
             if ssh_tunnel := self._properties.get("ssh_tunnel"):
                 ssh_tunnel = SSHTunnel(**ssh_tunnel)
 
diff --git a/superset/models/core.py b/superset/models/core.py
index 10c524a6d4..fa1e8ecf82 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -379,16 +379,16 @@ class Database(
             DatabaseDAO,
         )
 
-        logger.info("override_tunnel %s", str(override_ssh_tunnel))
+        logger.info("[ssh] override_tunnel %s", str(override_ssh_tunnel))
 
         tunnel = DatabaseDAO.get_ssh_tunnel(database_id=self.id)
-        logger.info("look up tunnel %s", str(tunnel))
+        logger.info("[ssh] look up tunnel %s", str(tunnel))
 
         if ssh_tunnel := override_ssh_tunnel or DatabaseDAO.get_ssh_tunnel(
             database_id=self.id
         ):
             # if ssh_tunnel is available build engine with information
-            logger.info("esablishing ssh tunnel connection")
+            logger.info("[ssh] establishing ssh tunnel connection")
             url = make_url_safe(self.sqlalchemy_uri_decrypted)
             ssh_params = ssh_tunnel.parameters(bind_host=url.host, bind_port=url.port)
             engine_context = sshtunnel.open_tunnel(**ssh_params)