You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/03/25 04:57:46 UTC

(superset) 01/01: fix(models): correct TabState.latest_query_id column type from Integer to String(11)

This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch fix-fab-upgrade
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a98de58003b1123b36012b0006d3c961aed137ec
Author: Joe Li <jo...@preset.io>
AuthorDate: Tue Mar 24 21:56:25 2026 -0700

    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 <no...@anthropic.com>
---
 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 7a6b246990d..7d303ffa99a 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")