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: Use clickhouse sqlglot dialect for YDB #31323

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

vgvoleg
Copy link
Contributor

@vgvoleg vgvoleg commented Dec 6, 2024

SUMMARY

Superset uses sqlglot to parse queries. It is not obvious in what cases it performs parsing and in what cases it doesnt, but we see an error where we are not able to use backticks and slashes in SQL Lab while creating datasets.
For example, query like

SELECT * FROM `prefix/some_name`

will fail because no sqlglot dialect is defined for YDB.

To have an ability to use db's with slashes we can use clickhouse's sqlglot dialect until we make our own.

Fixes #31322

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: Unable to use DB names with prefixes for YDB #31322
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Dec 6, 2024
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.81%. Comparing base (76d897e) to head (f670386).
Report is 1145 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #31323       +/-   ##
===========================================
+ Coverage   60.48%   83.81%   +23.32%     
===========================================
  Files        1931      537     -1394     
  Lines       76236    38991    -37245     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32680    -13434     
+ Misses      28017     6311    -21706     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.79% <ø> (-0.38%) ⬇️
javascript ?
mysql 76.54% <ø> (?)
postgres 76.60% <ø> (?)
presto 53.28% <ø> (-0.53%) ⬇️
python 83.81% <ø> (+20.32%) ⬆️
sqlite 76.06% <ø> (?)
unit 60.91% <ø> (+3.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vgvoleg vgvoleg changed the title Use clickhouse sqlglot dialect for YDB fix: Use clickhouse sqlglot dialect for YDB Dec 6, 2024
@michael-s-molina
Copy link
Member

@vgvoleg There's also the SQLGLOT_DIALECTS_EXTENSIONS option if this is a temporary fix.

@michael-s-molina michael-s-molina added the review:checkpoint Last PR reviewed during the daily review standup label Dec 6, 2024
Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM, but would be nice for ydb to create is own dialect, even if it's just importing the clickhouse one and overriding nothing at first, and allowing for a place if/where it may diverge

@mistercrunch mistercrunch merged commit 48c5ee4 into apache:master Dec 7, 2024
44 of 46 checks passed
@vgvoleg
Copy link
Contributor Author

vgvoleg commented Dec 9, 2024

LGTM, but would be nice for ydb to create is own dialect, even if it's just importing the clickhouse one and overriding nothing at first, and allowing for a place if/where it may diverge

as I see it will be not easy to use new sqlglot version

"sqlglot>=25.24.0,<25.25.0",

@michael-s-molina michael-s-molina removed the review:checkpoint Last PR reviewed during the daily review standup label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use DB names with prefixes for YDB
3 participants