From a98de58003b1123b36012b0006d3c961aed137ec Mon Sep 17 00:00:00 2001 From: Joe Li Date: Tue, 24 Mar 2026 21:56:25 -0700 Subject: [PATCH] fix(models): correct TabState.latest_query_id column type from Integer to String(11) The ORM model defined latest_query_id as Integer, but it references Query.client_id which is String(11). The original 2019 migration correctly used String(11). This mismatch was exposed by the FAB 5.1.0 to 5.2.0 upgrade, which now calls Model.metadata.create_all() in create_db() when the new ab_api_key table doesn't exist yet. Co-Authored-By: Claude Opus 4.6 --- superset/models/sql_lab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py index 7a6b246990db..7d303ffa99a3 100644 --- a/superset/models/sql_lab.py +++ b/superset/models/sql_lab.py @@ -540,7 +540,7 @@ class TabState(AuditMixinNullable, ExtraJSONMixin, Model): # latest query that was run latest_query_id = Column( - Integer, ForeignKey("query.client_id", ondelete="SET NULL") + String(11), ForeignKey("query.client_id", ondelete="SET NULL") ) latest_query = relationship("Query")