Skip to content

Commit abd72ca

Browse files
author
Claude Code
committed
fix: wire datetime_format into query pipeline via format_map
Build format_map from detected datetime formats stored in dataset columns and pass it to normalize_dttm_col() so the detected formats are actually used during query execution, eliminating the need for runtime detection.
1 parent dd66efa commit abd72ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

superset/models/helpers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,9 +1275,17 @@ def _get_timestamp_format(column: str | None) -> str | None:
12751275
)
12761276
)
12771277

1278+
# Build format map from detected datetime formats stored in dataset columns
1279+
format_map: dict[str, str] = {}
1280+
if hasattr(self, "columns"):
1281+
for col in self.columns:
1282+
if hasattr(col, "datetime_format") and col.datetime_format:
1283+
format_map[col.column_name] = col.datetime_format
1284+
12781285
normalize_dttm_col(
12791286
df=df,
12801287
dttm_cols=tuple(dttm_cols),
1288+
format_map=format_map if format_map else None,
12811289
)
12821290

12831291
# Convert metrics to numerical values if enforced

0 commit comments

Comments
 (0)