Skip to content

Commit

Permalink
fix: Handle Python date format for GENERIC_CHART_AXES feature (#25135)
Browse files Browse the repository at this point in the history
(cherry picked from commit de9515c)
  • Loading branch information
john-bodley authored and michael-s-molina committed Sep 1, 2023
1 parent dd0475d commit af8f074
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,13 @@ def adhoc_column_to_sqla( # pylint: disable=too-many-locals
time_grain = col.get("timeGrain")
has_timegrain = col.get("columnType") == "BASE_AXIS" and time_grain
is_dttm = False
pdf = None
if col_in_metadata := self.get_column(expression):
sqla_column = col_in_metadata.get_sqla_col(
template_processor=template_processor
)
is_dttm = col_in_metadata.is_temporal
pdf = col_in_metadata.python_date_format
else:
sqla_column = literal_column(expression)
if has_timegrain or force_type_check:
Expand All @@ -1012,7 +1014,7 @@ def adhoc_column_to_sqla( # pylint: disable=too-many-locals
if is_dttm and has_timegrain:
sqla_column = self.db_engine_spec.get_timestamp_expr(
col=sqla_column,
pdf=None,
pdf=pdf,
time_grain=time_grain,
)
return self.make_sqla_column_compatible(sqla_column, label)
Expand Down

0 comments on commit af8f074

Please sign in to comment.