mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore(pylint): Reenable raise-missing-from check (#16266)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
@@ -53,7 +53,7 @@ class CreateDatabaseCommand(BaseCommand):
|
||||
action=f"db_creation_failed.{ex.__class__.__name__}",
|
||||
engine=self._properties.get("sqlalchemy_uri", "").split(":")[0],
|
||||
)
|
||||
raise DatabaseConnectionFailedError()
|
||||
raise DatabaseConnectionFailedError() from ex
|
||||
|
||||
try:
|
||||
database = DatabaseDAO.create(self._properties, commit=False)
|
||||
@@ -73,7 +73,7 @@ class CreateDatabaseCommand(BaseCommand):
|
||||
action=f"db_creation_failed.{ex.__class__.__name__}",
|
||||
engine=database.db_engine_spec.__name__,
|
||||
)
|
||||
raise DatabaseCreateFailedError()
|
||||
raise DatabaseCreateFailedError() from ex
|
||||
return database
|
||||
|
||||
def validate(self) -> None:
|
||||
|
||||
@@ -48,7 +48,7 @@ class DeleteDatabaseCommand(BaseCommand):
|
||||
database = DatabaseDAO.delete(self._model)
|
||||
except DAODeleteFailedError as ex:
|
||||
logger.exception(ex.exception)
|
||||
raise DatabaseDeleteFailedError()
|
||||
raise DatabaseDeleteFailedError() from ex
|
||||
return database
|
||||
|
||||
def validate(self) -> None:
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestConnectionDatabaseCommand(BaseCommand):
|
||||
message=_("Could not load database driver: {}").format(
|
||||
database.db_engine_spec.__name__
|
||||
),
|
||||
)
|
||||
) from ex
|
||||
except DBAPIError as ex:
|
||||
event_logger.log_with_context(
|
||||
action=f"test_connection_error.{ex.__class__.__name__}",
|
||||
@@ -103,20 +103,20 @@ class TestConnectionDatabaseCommand(BaseCommand):
|
||||
)
|
||||
# check for custom errors (wrong username, wrong password, etc)
|
||||
errors = database.db_engine_spec.extract_errors(ex, context)
|
||||
raise DatabaseTestConnectionFailedError(errors)
|
||||
raise DatabaseTestConnectionFailedError(errors) from ex
|
||||
except SupersetSecurityException as ex:
|
||||
event_logger.log_with_context(
|
||||
action=f"test_connection_error.{ex.__class__.__name__}",
|
||||
engine=database.db_engine_spec.__name__,
|
||||
)
|
||||
raise DatabaseSecurityUnsafeError(message=str(ex))
|
||||
raise DatabaseSecurityUnsafeError(message=str(ex)) from ex
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
event_logger.log_with_context(
|
||||
action=f"test_connection_error.{ex.__class__.__name__}",
|
||||
engine=database.db_engine_spec.__name__,
|
||||
)
|
||||
errors = database.db_engine_spec.extract_errors(ex, context)
|
||||
raise DatabaseTestConnectionUnexpectedError(errors)
|
||||
raise DatabaseTestConnectionUnexpectedError(errors) from ex
|
||||
|
||||
def validate(self) -> None:
|
||||
database_name = self._properties.get("database_name")
|
||||
|
||||
@@ -56,7 +56,7 @@ class UpdateDatabaseCommand(BaseCommand):
|
||||
schemas = database.get_all_schema_names()
|
||||
except Exception as ex:
|
||||
db.session.rollback()
|
||||
raise DatabaseConnectionFailedError()
|
||||
raise DatabaseConnectionFailedError() from ex
|
||||
for schema in schemas:
|
||||
security_manager.add_permission_view_menu(
|
||||
"schema_access", security_manager.get_schema_perm(database, schema)
|
||||
@@ -65,7 +65,7 @@ class UpdateDatabaseCommand(BaseCommand):
|
||||
|
||||
except DAOUpdateFailedError as ex:
|
||||
logger.exception(ex.exception)
|
||||
raise DatabaseUpdateFailedError()
|
||||
raise DatabaseUpdateFailedError() from ex
|
||||
return database
|
||||
|
||||
def validate(self) -> None:
|
||||
|
||||
@@ -126,7 +126,7 @@ class ValidateDatabaseParametersCommand(BaseCommand):
|
||||
"database": url.database,
|
||||
}
|
||||
errors = database.db_engine_spec.extract_errors(ex, context)
|
||||
raise DatabaseTestConnectionFailedError(errors)
|
||||
raise DatabaseTestConnectionFailedError(errors) from ex
|
||||
|
||||
if not alive:
|
||||
raise DatabaseOfflineError(
|
||||
|
||||
Reference in New Issue
Block a user