You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/30 16:39:35 UTC

[GitHub] [superset] Antonio-RiveroMartnez commented on a diff in pull request #22199: feat(ssh_tunnel): APIs for SSH Tunnels

Antonio-RiveroMartnez commented on code in PR #22199:
URL: https://github.com/apache/superset/pull/22199#discussion_r1036202956


##########
superset/databases/commands/update.py:
##########
@@ -94,11 +95,35 @@ def run(self) -> Model:
                 security_manager.add_permission_view_menu(
                     "schema_access", security_manager.get_schema_perm(database, schema)
                 )
+
+            if ssh_tunnel_properties := self._properties.get("ssh_tunnel"):
+                existing_ssh_tunnel = DatabaseDAO.get_ssh_tunnel(database.id)
+                if existing_ssh_tunnel is None:
+                    # We couldn't found an existing tunnel so we need to create one
+                    SSHTunnelDAO.create(
+                        {
+                            **ssh_tunnel_properties,
+                            "database_id": database.id,
+                        },
+                        commit=False,
+                    )
+                else:
+                    # We found an existing tunnel so we need to update it
+                    ssh_tunnel_model = SSHTunnelDAO.find_by_id(existing_ssh_tunnel.id)

Review Comment:
   leftover from when it was a dict. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org