Skip to content

Commit

Permalink
remove parathesis around columns
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh authored Jul 11, 2022
1 parent 16ea687 commit 3f6fa0a
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions superset/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,6 @@ def get_from_clause(
or a virtual table with it's own subquery. If the FROM is referencing a
CTE, the CTE is returned as the second value in the return tuple.
"""
# todo(hugh): fix this
# if not self.is_virtual:
# return self.get_sqla_table(), None

from_sql = self.get_rendered_sql(template_processor)
parsed_query = ParsedQuery(from_sql)
Expand Down Expand Up @@ -1236,9 +1233,7 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
"time_column": granularity,
"time_grain": time_grain,
"to_dttm": to_dttm.isoformat() if to_dttm else None,
"table_columns": [
col.get("column_name") for col in self.columns
], # [col.column_name for col in self.columns],
"table_columns": [col.get("column_name") for col in self.columns],
"filter": filter,
}
columns = columns or []
Expand Down Expand Up @@ -1376,7 +1371,7 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
# if groupby field equals a selected column
elif selected in columns_by_name:
if isinstance(columns_by_name[selected], dict):
outer = literal_column(f"({selected})")
outer = literal_column(f"{selected}")
outer = self.make_sqla_column_compatible(outer, selected)
else:
outer = columns_by_name[selected].get_sqla_col()
Expand Down Expand Up @@ -1431,22 +1426,6 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
select_exprs.insert(0, timestamp)
groupby_all_columns[timestamp.name] = timestamp

# Use main dttm column to support index with secondary dttm columns.
if (
db_engine_spec.time_secondary_columns
and self.main_dttm_col in self.dttm_cols
and self.main_dttm_col != dttm_col.column_name
):
pass
# todo(hughhh): fix time filter
# time_filters.append(
# columns_by_name[self.main_dttm_col].get_time_filter(
# from_dttm,
# to_dttm,
# )
# )
# time_filters.append(dttm_col.get_time_filter(from_dttm, to_dttm))

# Always remove duplicates by column name, as sometimes `metrics_exprs`
# can have the same name as a groupby column (e.g. when users use
# raw columns as custom SQL adhoc metric).
Expand Down Expand Up @@ -1618,7 +1597,7 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
raise QueryObjectValidationError(
_("Invalid filter operation type: %(op)s", op=op)
)
# todo(hugh): fix this
# todo(hugh): fix this w/ template_processor
# where_clause_and += self.get_sqla_row_level_filters(template_processor)
if extras:
where = extras.get("where")
Expand Down

0 comments on commit 3f6fa0a

Please sign in to comment.