villebro commented on a change in pull request #9284: Reduce dashboard
bootstrap payload
URL:
https://github.com/apache/incubator-superset/pull/9284#discussion_r391880918
##########
File path: superset/connectors/base/models.py
##########
@@ -213,6 +230,87 @@ def data(self) -> Dict[str, Any]:
"select_star": self.select_star,
}
+ @staticmethod
+ def get_metric_name_from_metric(
+ metric: Union[str, Dict[str, Any]]
+ ) -> Optional[str]:
+ if isinstance(metric, str):
+ return metric
+
+ if isinstance(metric, dict) and metric.get("metric_name"):
+ return metric.get("metric_name")
+
+ return None
Review comment:
I've been digesting this today, and I still think something isn't right
here. If you look at `viz.py`, it's full of references to metrics in form_data.
Copy/paste from `viz.py`: `utils.get_metric_names(self.form_data.get("metrics")
or [])`. Are these really regular ad-hoc metrics that have been generated by
Superset controls? I put a break point on `viz.py` with a viz with an ad-hoc
metric, and that had the metric name in `label`, not `metric_name`. Is there a
chance that we have different metric signature conventions in different parts
of the codebase?
----------------------------------------------------------------
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]