Vitor-Avila commented on code in PR #33250:
URL: https://github.com/apache/superset/pull/33250#discussion_r2060678201


##########
superset/commands/database/update.py:
##########
@@ -80,9 +80,19 @@ def run(self) -> Model:
             # existing personal tokens.
             self._handle_oauth2()
 
-        # build new DB
+        # Some DBs require running a query to get the default catalog.
+        # In these cases, if the current connection is broken then
+        # `get_default_catalog` would raise an exception. We need to
+        # gracefully handle that so that the connection can be fixed.
         original_database_name = self._model.database_name
-        original_catalog = self._model.get_default_catalog()
+        force_update: bool = False
+        try:
+            original_catalog = self._model.get_default_catalog()
+        except Exception:

Review Comment:
   I think it's not needed, as this failure would be expected in case the 
"current" credentials are not working properly, and the new credentials should 
have been validated already through the `/validate_parameters` check.
   
   For safety, we're then later updating the catalog on existing assets in case 
the connection does not allow multi-catalog, so I believe we're good.
   
   Should be a quick change to add it if you think it's best, tho. :) 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to