Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert "feat(sqla): apply time grain to all temporal groupbys" #17239

Merged
merged 3 commits into from
Oct 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,16 +1092,16 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
columns = groupby or columns
for selected in columns:
# if groupby field/expr equals granularity field/expr
table_col = columns_by_name.get(selected)
if table_col and table_col.type_generic == GenericDataType.TEMPORAL:
outer = table_col.get_timestamp_expression(
if selected == granularity:
sqla_col = columns_by_name[selected]
outer = sqla_col.get_timestamp_expression(
time_grain=time_grain,
label=selected,
template_processor=template_processor,
)
# if groupby field equals a selected column
elif table_col:
outer = table_col.get_sqla_col()
elif selected in columns_by_name:
outer = columns_by_name[selected].get_sqla_col()
else:
outer = literal_column(f"({selected})")
outer = self.make_sqla_column_compatible(outer, selected)
Expand Down