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 16:35:36 UTC
[superset] 02/02: fix logging one more time
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 46e161908b2d9d904c8c873e900d9eeece7e5e4b
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Dec 8 11:35:13 2022 -0500
fix logging one more time
---
superset/databases/commands/create.py | 7 ++++++-
superset/databases/commands/test_connection.py | 7 ++++++-
superset/models/core.py | 6 +-----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/superset/databases/commands/create.py b/superset/databases/commands/create.py
index 5d9141ac0e..c5ad3a0f44 100644
--- a/superset/databases/commands/create.py
+++ b/superset/databases/commands/create.py
@@ -73,7 +73,12 @@ class CreateDatabaseCommand(BaseCommand):
database.set_sqlalchemy_uri(database.sqlalchemy_uri)
ssh_tunnel = None
- logger.info("grabbing schemas: %d", self._properties.get("ssh_tunnel"))
+ 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(
{
diff --git a/superset/databases/commands/test_connection.py b/superset/databases/commands/test_connection.py
index b70c0ee136..0e4f3e032e 100644
--- a/superset/databases/commands/test_connection.py
+++ b/superset/databases/commands/test_connection.py
@@ -92,7 +92,12 @@ class TestConnectionDatabaseCommand(BaseCommand):
database.db_engine_spec.mutate_db_for_connection_test(database)
# Generate tunnel if present in the properties
- logger.info("testing connection: %d", self._properties.get("ssh_tunnel"))
+ 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 a9485c858c..0cef66934f 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -380,15 +380,11 @@ class Database(
)
logger.info("override_tunnel %s", str(override_ssh_tunnel))
- logger.info("lookup %d", DatabaseDAO.get_ssh_tunnel(
- database_id=self.id
- ))
-
+
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("Creating ssh tunnel for db: %i", int(self.id))
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)