Skip to content

Commit

Permalink
[fix] Reverting metic logic from #8901 (#9030)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley committed Jan 28, 2020
1 parent d0aab05 commit dc60db2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion superset/common/query_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ def __init__(
self.time_shift = utils.parse_human_timedelta(time_shift)
self.groupby = groupby or []

self.metrics = [utils.get_metric_name(metric) for metric in metrics]
# Temporal solution for backward compatability issue due the new format of
# non-ad-hoc metric which needs to adhere to superset-ui per
# https://git.io/Jvm7P.
self.metrics = [
metric if "expressionType" in metric else metric["label"] # type: ignore
for metric in metrics
]

self.row_limit = row_limit
self.filter = filters or []
self.timeseries_limit = timeseries_limit
Expand Down
2 changes: 1 addition & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _get_query_context_dict(self) -> Dict[str, Any]:
{
"granularity": "ds",
"groupby": ["name"],
"metrics": ["sum__num"],
"metrics": [{"label": "sum__num"}],
"filters": [],
"row_limit": 100,
}
Expand Down

0 comments on commit dc60db2

Please sign in to comment.