michellethomas commented on a change in pull request #9196: [Bug Fix] Returning
timeseries_limit_metric in table viz get_data
URL:
https://github.com/apache/incubator-superset/pull/9196#discussion_r384211748
##########
File path: superset/viz.py
##########
@@ -575,15 +575,29 @@ def get_data(self, df: pd.DataFrame) -> VizData:
the percent metrics have yet to be transformed.
"""
- if not self.should_be_timeseries() and DTTM_ALIAS in df:
- del df[DTTM_ALIAS]
-
+ non_percent_metric_columns = []
# Transform the data frame to adhere to the UI ordering of the columns
and
# metrics whilst simultaneously computing the percentages (via
normalization)
# for the percent metrics.
- non_percent_metric_columns = (
+
+ if not self.should_be_timeseries() and DTTM_ALIAS in df:
+ del df[DTTM_ALIAS]
+ elif self.should_be_timeseries() and DTTM_ALIAS in df:
+ non_percent_metric_columns.append(DTTM_ALIAS)
+
+ non_percent_metric_columns.extend(
self.form_data.get("all_columns") or self.form_data.get("groupby")
or []
- ) + utils.get_metric_names(self.form_data.get("metrics") or [])
+ )
+
+ non_percent_metric_columns.extend(
+ utils.get_metric_names(self.form_data.get("metrics") or [])
+ )
Review comment:
I'm just extending them separately because it feels a bit more readable,
rather than extending list + list.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]