villebro commented on a change in pull request #9284: Reduce dashboard 
bootstrap payload
URL: 
https://github.com/apache/incubator-superset/pull/9284#discussion_r391301159
 
 

 ##########
 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:
   The weird thing is what you're describing sounds more or less exactly like 
the other metrics that `get_metric_name` deals with. We don't need to deal with 
that now as it's outside the scope of this PR, but we definitely need to figure 
this out in the long run.

----------------------------------------------------------------
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]

Reply via email to