From 102f48a0d2798f578c2405d6359a073cc7c96604 Mon Sep 17 00:00:00 2001 From: busya Date: Thu, 4 Jun 2026 23:59:11 +0300 Subject: [PATCH] 032: fix UnboundLocalError for db_name in validate_target_table_schema db_name and backend were initialized inside the try block but referenced in the except handler. If an exception occurred before their assignment (e.g. in resolve_database_id), the except block would raise: cannot access local variable 'db_name' where it is not associated Moved initialization before try with safe defaults. --- backend/src/plugins/translate/service_target_schema.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/plugins/translate/service_target_schema.py b/backend/src/plugins/translate/service_target_schema.py index 9a5fc381..5d87db2f 100644 --- a/backend/src/plugins/translate/service_target_schema.py +++ b/backend/src/plugins/translate/service_target_schema.py @@ -233,6 +233,9 @@ def validate_target_table_schema( logger.reason("Querying target table schema", extra={"payload": {"table": target_ref, "env": req.environment_id, "db_id": req.target_database_id}}) + backend = "" + db_name = "unknown" + try: executor = SupersetSqlLabExecutor(config_manager, req.environment_id) executor.resolve_database_id(target_database_id=req.target_database_id)