Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Mar 3, 2023
1 parent 558f348 commit ce1843d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions superset/common/query_context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ def get_query_result(self, query_object: QueryObject) -> QueryResult:
# todo(hugh): add logic to manage all sip68 models here
result = query_context.datasource.exc_query(query_object.to_dict())
else:
query_object_dict = query_object.to_dict()
query_object_dict.update({"datasource": query_context.datasource})
result = query_context.datasource.query(query_object_dict)
result = query_context.datasource.query(query_object.to_dict())
query = result.query + ";\n\n"

df = result.df
Expand Down
6 changes: 2 additions & 4 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,6 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
self,
apply_fetch_values_predicate: bool = False,
columns: Optional[List[ColumnTyping]] = None,
datasource: Optional[BaseDatasource] = None,
extras: Optional[Dict[str, Any]] = None,
filter: Optional[ # pylint: disable=redefined-builtin
List[QueryObjectFilterClause]
Expand Down Expand Up @@ -1175,7 +1174,6 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
if granularity not in self.dttm_cols and granularity is not None:
granularity = self.main_dttm_col

datasource_column_names = datasource.column_names if datasource else []
extras = extras or {}
time_grain = extras.get("time_grain_sqla")

Expand Down Expand Up @@ -1792,15 +1790,15 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
for col in filter_columns
if col
and not is_adhoc_column(col)
and col not in datasource_column_names
and col not in self.column_names
and col not in applied_template_filters
] + rejected_adhoc_filters_columns
applied_filter_columns = [
col
for col in filter_columns
if col
and not is_adhoc_column(col)
and (col in datasource_column_names or col in applied_template_filters)
and (col in self.column_names or col in applied_template_filters)
] + applied_adhoc_filters_columns

return SqlaQuery(
Expand Down

0 comments on commit ce1843d

Please sign in to comment.