villebro commented on a change in pull request #9284: Reduce dashboard
bootstrap payload
URL:
https://github.com/apache/incubator-superset/pull/9284#discussion_r391291927
##########
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 remember causing a regression a while back with similar reasoning as I did
here. I didn't bother doing a deep dive into understanding how these differ
from each other then, but it seems I need to, as I don't want to make the same
mistake a third time. Is there a known reason why these metrics are different
from the ones that appear in `viz.py` or `sqla/models.py`?
----------------------------------------------------------------
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]