-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: alias column when fetching values #26120
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #26120 +/- ##
=======================================
Coverage 69.10% 69.10%
=======================================
Files 1940 1940
Lines 75869 75869
Branches 8445 8445
=======================================
Hits 52428 52428
Misses 21266 21266
Partials 2175 2175
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
(cherry picked from commit 7223633)
🏷️ preset:2023.47 |
# automatically add a random alias to the projection because of the | ||
# call to DISTINCT; others will uppercase the column names. This | ||
# gives us a deterministic column name in the dataframe. | ||
[target_col.get_sqla_col(template_processor=tp).label("column_values")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a comment explaining the context! It's always helpful.
(cherry picked from commit 7223633)
(cherry picked from commit 7223633)
(cherry picked from commit 7223633)
SUMMARY
The endpoint that returns values for a given column, which powers filter dropdowns, is failing for some databases (Snowflake, Clickhouse) because the query generated has an unusual alias for the column.
For example, for Clickhouse, when selecting the values of a column called
name
we have the following query:Clickhouse adds the stochastic alias
name_#####
, and reading the values from the Pandas dataframe fails because the columnname
is not present.For Snowflake we have a different issue:
Here, the resulting dataframe will have
NAME
but notname
, since for Snowflake these are identical.This PR fixes the problem by adding an alias to the projection. This way we know the alias is present in the dataframe.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION