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: type error bug in convert_tbl_column_to_sqla_col #31780

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
2 changes: 1 addition & 1 deletion superset/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ def convert_tbl_column_to_sqla_col(
) -> Column:
label = label or tbl_column.column_name
db_engine_spec = self.db_engine_spec
column_spec = db_engine_spec.get_column_spec(self.type, db_extra=self.db_extra)
column_spec = db_engine_spec.get_column_spec(tbl_column.type, db_extra=self.db_extra)
Copy link

Choose a reason for hiding this comment

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

Missing type null check category Functionality

Tell me more
What is the issue?

Missing null check for tbl_column.type before calling get_column_spec

Why this matters

If tbl_column.type is None, get_column_spec() may raise an error since some database engines cannot handle None type inputs.

Suggested change ∙ Feature Preview

Add null check before getting column spec:

column_spec = None
if tbl_column.type is not None:
    column_spec = db_engine_spec.get_column_spec(tbl_column.type, db_extra=self.db_extra)
Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

type_ = column_spec.sqla_type if column_spec else None
if expression := tbl_column.expression:
if template_processor:
Expand Down
Loading