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(sqllab): Do not strip comments when executing SQL statements #29248

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Jun 14, 2024

SUMMARY

Man, the SQL Lab execution/parsing logic is a real rabbit warren—so many methods and diversions to execute SQL.

#27725 attempted to remove stripping comments when executing queries in SQL Lab, however it likely wasn't suffice. #28363 (which also preventing stripping of comments in Explore) remedied this, however it was later reverted in #28567.

The original issue with #27725 is it seems like the SQL is pre-processed/rendered in the command prior to the typical SQL Lab execution logic via Celery et al. This PR simply ensures that comments are never stripped within the context of SQL Lab. This change shouldn't cause the issue surfaced in #28567.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI. The relevant tests were updated using logic from #28363.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@john-bodley john-bodley changed the title fix(sqllab): : Do not strip comments when executing SQL statements fix(sqllab): Do not strip comments when executing SQL statements Jun 14, 2024
@john-bodley john-bodley force-pushed the john-bodley--sqllab-dont-strip-comments branch from 5f49448 to d27b3e8 Compare June 14, 2024 03:09
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.73%. Comparing base (76d897e) to head (d27b3e8).
Report is 315 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #29248       +/-   ##
===========================================
+ Coverage   60.48%   83.73%   +23.24%     
===========================================
  Files        1931      518     -1413     
  Lines       76236    37541    -38695     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    31435    -14679     
+ Misses      28017     6106    -21911     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.94% <ø> (-0.23%) ⬇️
javascript ?
mysql 77.23% <ø> (?)
postgres 77.34% <ø> (?)
presto 53.55% <ø> (-0.25%) ⬇️
python 83.73% <ø> (+20.24%) ⬆️
sqlite 76.80% <ø> (?)
unit 59.24% <ø> (+1.61%) ⬆️

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.

@john-bodley john-bodley marked this pull request as ready for review June 14, 2024 09:36
@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Jun 14, 2024
@rusackas
Copy link
Member

rusackas commented Jun 14, 2024

a real rabbit warren

... I think this is the first time I've ever heard someone use the correct nomenclature with this expression.

@michael-s-molina michael-s-molina merged commit b50e3af into apache:master Jun 14, 2024
66 checks passed
@michael-s-molina michael-s-molina added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label Jun 14, 2024
@john-bodley john-bodley deleted the john-bodley--sqllab-dont-strip-comments branch June 14, 2024 17:23
michael-s-molina pushed a commit that referenced this pull request Jun 14, 2024
@mistercrunch mistercrunch added 🍒 4.0.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS sqllab Namespace | Anything related to the SQL Lab v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🍒 4.0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants