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: always denorm column value before querying values #25919

Merged
merged 8 commits into from
Nov 13, 2023
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
8 changes: 7 additions & 1 deletion superset/datasource/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,14 @@ def get_column_values(

row_limit = apply_max_row_limit(app.config["FILTER_SELECT_ROW_LIMIT"])
try:
# always denormalize column name before querying for values
db_engine_spec = datasource.database.db_engine_spec
db_dialect = datasource.database.get_dialect()
denomalized_col_name = db_engine_spec.denormalize_name(
db_dialect, 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.

It's better to move this logic to the datasource.values_for_column method, so that the API doesn't have any business logic, and so that calls to datasource.values_for_column from other places also work as expected.

payload = datasource.values_for_column(
column_name=column_name, limit=row_limit
column_name=denomalized_col_name, limit=row_limit
)
return self.response(200, result=payload)
except NotImplementedError:
Expand Down
Loading