This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch ssh-manager-config
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/ssh-manager-config by this
push:
new 25226604d1 refactor exceptions and add mutator
25226604d1 is described below
commit 25226604d1a2dac94dcd9412353bb38e6df24e19
Author: hughhhh <[email protected]>
AuthorDate: Tue Nov 22 17:25:14 2022 -0500
refactor exceptions and add mutator
---
superset/models/core.py | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/superset/models/core.py b/superset/models/core.py
index 25adc61942..37c96feffa 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -385,25 +385,18 @@ class Database(
ssh_params = ssh_tunnel.parameters()
if ssh_tunnel_manager:
ssh_params = ssh_tunnel_manager.mutate(ssh_params)
- try:
- with sshtunnel.open_tunnel(**ssh_params) as server:
- yield self._get_sqla_engine(
- schema=schema,
- nullpool=nullpool,
- source=source,
- ssh_tunnel_server=server,
- )
- except Exception as ex:
- raise ex
-
- else:
- # do look up in table for using database_id
- try:
+ with sshtunnel.open_tunnel(**ssh_params) as server:
yield self._get_sqla_engine(
- schema=schema, nullpool=nullpool, source=source
+ schema=schema,
+ nullpool=nullpool,
+ source=source,
+ ssh_tunnel_server=server,
)
- except Exception as ex:
- raise ex
+ else:
+ # do look up in table for using database_id
+ yield self._get_sqla_engine(
+ schema=schema, nullpool=nullpool, source=source
+ )
def _get_sqla_engine(
self,