hughhhh commented on code in PR #22199:
URL: https://github.com/apache/superset/pull/22199#discussion_r1060822143


##########
superset/databases/commands/create.py:
##########
@@ -71,17 +75,26 @@ def run(self) -> Model:
         try:
             database = DatabaseDAO.create(self._properties, commit=False)
             database.set_sqlalchemy_uri(database.sqlalchemy_uri)
-            db.session.flush()
 
             ssh_tunnel = None
             if ssh_tunnel_properties := self._properties.get("ssh_tunnel"):
-                ssh_tunnel = SSHTunnelDAO.create(
-                    {
-                        **ssh_tunnel_properties,
-                        "database_id": database.id,
-                    },
-                    commit=False,
-                )
+                try:
+                    # So database.id is not None
+                    db.session.flush()
+                    CreateSSHTunnelCommand(database.id, 
ssh_tunnel_properties).run()

Review Comment:
   we need to have a reference for `ssh_tunnel` after it's created so it can 
pull down all the schema
   
   
https://github.com/apache/superset/pull/22199/files#diff-c3f1c5afb1b73f705f01bfa24cb4ca2ac66b84f82875abd3ddb73cb8147ea77eR100



-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to