betodealmeida commented on code in PR #40580:
URL: https://github.com/apache/superset/pull/40580#discussion_r3337109835


##########
superset/models/sql_lab.py:
##########
@@ -588,6 +588,17 @@ class TabState(AuditMixinNullable, ExtraJSONMixin, Model):
     saved_query = relationship("SavedQuery", foreign_keys=[saved_query_id])
 
     def to_dict(self) -> dict[str, Any]:
+        latest_query = None
+        try:
+            if self.latest_query:
+                latest_query = self.latest_query.to_dict()
+        except Exception:
+            logger.warning(
+                "Failed to load/serialize latest_query for tab state %s",

Review Comment:
   Do we need what causes us to save a query with a bad state that breaks 
`to_dict()`? Ideally we'd always save something that can be loaded successfully.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to