From f2b54e882ddeb89af894b00af8860a0ef2abca9c Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Fri, 23 Jan 2026 16:27:51 +0000 Subject: [PATCH] fix: variable shadowing in test_connection command (#37397) --- superset/commands/database/test_connection.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/superset/commands/database/test_connection.py b/superset/commands/database/test_connection.py index fb922038ee5..1395994d73e 100644 --- a/superset/commands/database/test_connection.py +++ b/superset/commands/database/test_connection.py @@ -95,7 +95,7 @@ class TestConnectionDatabaseCommand(BaseCommand): ex_str = "" url = make_url_safe(self._uri) - engine = url.get_backend_name() + engine_name = url.get_backend_name() serialized_encrypted_extra = self._properties.get( "masked_encrypted_extra", @@ -136,7 +136,7 @@ class TestConnectionDatabaseCommand(BaseCommand): "test_connection_attempt", ssh_tunnel_properties, ), - engine=engine, + engine=engine_name, ) with database.get_sqla_engine() as engine: @@ -174,7 +174,7 @@ class TestConnectionDatabaseCommand(BaseCommand): "test_connection_success", ssh_tunnel_properties, ), - engine=engine, + engine=engine_name, ) except (NoSuchModuleError, ModuleNotFoundError) as ex: @@ -184,12 +184,12 @@ class TestConnectionDatabaseCommand(BaseCommand): ssh_tunnel_properties, ex, ), - engine=engine, + engine=engine_name, ) raise DatabaseTestConnectionDriverError( message=_( "Could not load database driver for: %(engine)s", - engine=engine, + engine=engine_name, ), ) from ex except DBAPIError as ex: @@ -199,7 +199,7 @@ class TestConnectionDatabaseCommand(BaseCommand): ssh_tunnel_properties, ex, ), - engine=engine, + engine=engine_name, ) if not database: @@ -218,7 +218,7 @@ class TestConnectionDatabaseCommand(BaseCommand): ssh_tunnel_properties, ex, ), - engine=engine, + engine=engine_name, ) raise DatabaseSecurityUnsafeError(message=str(ex)) from ex except (SupersetTimeoutException, SSHTunnelingNotEnabledError) as ex: @@ -228,7 +228,7 @@ class TestConnectionDatabaseCommand(BaseCommand): ssh_tunnel_properties, ex, ), - engine=engine, + engine=engine_name, ) # bubble up the exception to return proper status code raise @@ -246,7 +246,7 @@ class TestConnectionDatabaseCommand(BaseCommand): ssh_tunnel_properties, ex, ), - engine=engine, + engine=engine_name, ) errors = database.db_engine_spec.extract_errors(ex, self._context) raise DatabaseTestConnectionUnexpectedError(errors) from ex