rusackas commented on code in PR #41964:
URL: https://github.com/apache/superset/pull/41964#discussion_r3565544459


##########
superset/connectors/sqla/models.py:
##########
@@ -1516,7 +1516,18 @@ def full_name(self) -> str:
     def dttm_cols(self) -> list[str]:
         l = [c.column_name for c in self.columns if c.is_dttm]  # noqa: E741
         if self.main_dttm_col and self.main_dttm_col not in l:
-            l.append(self.main_dttm_col)
+            # Only treat ``main_dttm_col`` as a datetime column when the 
column it
+            # points to is actually temporal. A column whose "Is Temporal" 
flag was
+            # removed must not keep being reported as a datetime column just 
because
+            # it is still referenced by ``main_dttm_col`` (#30510). When the 
column
+            # is not present on the dataset, fall back to the legacy behavior 
of
+            # trusting ``main_dttm_col``.
+            main_dttm_column = next(
+                (c for c in self.columns if c.column_name == 
self.main_dttm_col),
+                None,
+            )
+            if main_dttm_column is None or main_dttm_column.is_dttm:
+                l.append(self.main_dttm_col)

Review Comment:
   Line 1517 above already filters every other column by the raw `is_dttm` 
flag, not `is_temporal`. Switching just this fallback would make main_dttm_col 
more lenient than the rest of dttm_cols for the same NULL-flag case, which is 
its own separate issue predating this PR. Keeping the two branches consistent 
here.



-- 
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