Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Unhandled exception Str Column Type #22147

Merged
merged 4 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion superset/connectors/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@villebro sorry for the late reply. As you mentioned correctly, I missed the check for AdhocMetric. The issue was not with metric param, rather with column. Added a check around that.

)

# Columns used in query filters
Expand Down