[fix] Reverting metic logic from #8901 (#9030)

This commit is contained in:
John Bodley 2020-01-27 22:28:42 -08:00 committed by GitHub
parent d0aab05e79
commit dc60db2a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -81,7 +81,14 @@ class QueryObject:
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

View File

@ -109,7 +109,7 @@ class CoreTests(SupersetTestCase):
{
"granularity": "ds",
"groupby": ["name"],
"metrics": ["sum__num"],
"metrics": [{"label": "sum__num"}],
"filters": [],
"row_limit": 100,
}