mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
fix: revert "feat(sqla): apply time grain to all temporal groupbys" (#17239)
* Revert "feat(sqla): apply time grain to all temporal groupbys (#16318)"
This reverts commit 9075e4206c
.
* Update models.py
This commit is contained in:
parent
456efc0c20
commit
b7bda7031e
@ -1092,16 +1092,16 @@ class SqlaTable(Model, BaseDatasource): # pylint: disable=too-many-public-metho
|
|||||||
columns = groupby or columns
|
columns = groupby or columns
|
||||||
for selected in columns:
|
for selected in columns:
|
||||||
# if groupby field/expr equals granularity field/expr
|
# if groupby field/expr equals granularity field/expr
|
||||||
table_col = columns_by_name.get(selected)
|
if selected == granularity:
|
||||||
if table_col and table_col.type_generic == GenericDataType.TEMPORAL:
|
sqla_col = columns_by_name[selected]
|
||||||
outer = table_col.get_timestamp_expression(
|
outer = sqla_col.get_timestamp_expression(
|
||||||
time_grain=time_grain,
|
time_grain=time_grain,
|
||||||
label=selected,
|
label=selected,
|
||||||
template_processor=template_processor,
|
template_processor=template_processor,
|
||||||
)
|
)
|
||||||
# if groupby field equals a selected column
|
# if groupby field equals a selected column
|
||||||
elif table_col:
|
elif selected in columns_by_name:
|
||||||
outer = table_col.get_sqla_col()
|
outer = columns_by_name[selected].get_sqla_col()
|
||||||
else:
|
else:
|
||||||
outer = literal_column(f"({selected})")
|
outer = literal_column(f"({selected})")
|
||||||
outer = self.make_sqla_column_compatible(outer, selected)
|
outer = self.make_sqla_column_compatible(outer, selected)
|
||||||
|
Loading…
Reference in New Issue
Block a user