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:48 UTC

[superset] branch testing-tunnel updated (46e161908b -> 53a7df182c)

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

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


    from 46e161908b fix logging one more time
     new 8627502417 lets see if we can look up the right tunnel
     new 53a7df182c remove some logs and using ad

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 superset/databases/commands/create.py          | 5 +----
 superset/databases/commands/test_connection.py | 6 ------
 superset/models/core.py                        | 6 +++++-
 3 files changed, 6 insertions(+), 11 deletions(-)


[superset] 01/02: lets see if we can look up the right tunnel

Posted by hu...@apache.org.
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 862750241753488b8e71153a630dd5d91e0bb87c
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Dec 8 12:34:36 2022 -0500

    lets see if we can look up the right tunnel
---
 superset/models/core.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/superset/models/core.py b/superset/models/core.py
index 0cef66934f..10c524a6d4 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -381,10 +381,14 @@ class Database(
 
         logger.info("override_tunnel %s", str(override_ssh_tunnel))
 
+        tunnel = DatabaseDAO.get_ssh_tunnel(database_id=self.id)
+        logger.info("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")
             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)


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

Posted by hu...@apache.org.
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)