You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/17 06:34:44 UTC

[GitHub] [superset] villebro commented on a diff in pull request #22147: fix: Unhandled exception for Any metric type

villebro commented on code in PR #22147:
URL: https://github.com/apache/superset/pull/22147#discussion_r1024800714


##########
superset/connectors/base/models.py:
##########
@@ -313,7 +313,9 @@ def data_for_slices(  # pylint: disable=too-many-locals
                     metric_names.add(utils.get_metric_name(metric))
                     if utils.is_adhoc_metric(metric):
                         column_names.add(
-                            (metric.get("column") or {}).get("column_name")
+                            (
+                                (hasattr(metric, "get") and metric.get("column")) or {}
+                            ).get("column_name")

Review Comment:
   On line 314 we're already calling a type guard making sure that the type is in fact `AdhocMetric`. So it appears there may be something wrong either in the declaration of the `AdhocMetric` type or the type guard. Can you post the full stack trace of the error you're seeing and see if we need to update either one of those instead?



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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org