Antonio-RiveroMartnez commented on code in PR #21838:
URL: https://github.com/apache/superset/pull/21838#discussion_r999960344
##########
superset/databases/commands/create.py:
##########
@@ -46,6 +48,34 @@ def run(self) -> Model:
try:
# Test connection before starting create transaction
TestConnectionDatabaseCommand(self._properties).run()
+ except DatabaseTestConnectionFailedError as ex:
+ event_logger.log_with_context(
+ action=f"db_creation_failed.{ex.__class__.__name__}",
+ engine=self._properties.get("sqlalchemy_uri",
"").split(":")[0],
+ )
+ # if the exception is DatabaseTestConnectionFailedError it has
errors in it
+ # so we try to return the message from the errors instead of using
the
+ # default message
+ error_list: List[SupersetError] = ex.errors
+ for error in error_list:
Review Comment:
Hmm `error_list` contains a list of `SupersetError`, while
`SupersetErrorType.CONNECTION_DATABASE_PERMISSIONS_ERROR` is just a enum, that
comparison won't work. Reducing error_list would also require iterating over
the list, so, let me see if there's a more "Pythonic" way of checking without
looping.
--
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]