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] Reverting metic logic from #8901 #9030

Merged
merged 1 commit into from Jan 28, 2020
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion superset/common/query_object.py
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
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