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

chore(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction #27842

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Apr 1, 2024

SUMMARY

It seems like it's not uncommon for users to use the latest[_sub]_partition Jinja macros wrongly in terms of including a leading or trailing whitespace, i.e., latest_partition(' foo.bar ') which actually works as this table name is extracted and injected into SQL where additional leading/trailing whitespace is allowed.

This PR makes sure that when we extract the table name from the Jinja macro we strip any leading/trailing whitespace.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI.

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

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.83%. Comparing base (a664e21) to head (907c2a1).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #27842   +/-   ##
=======================================
  Coverage   69.83%   69.83%           
=======================================
  Files        1920     1920           
  Lines       75242    75242           
  Branches     8423     8423           
=======================================
  Hits        52545    52545           
  Misses      20636    20636           
  Partials     2061     2061           
Flag Coverage Δ
hive 48.93% <ø> (ø)
mysql 77.88% <ø> (ø)
postgres 77.99% <ø> (ø)
presto 53.63% <ø> (ø)
python 83.15% <ø> (ø)
sqlite 77.43% <ø> (ø)
unit 56.78% <ø> (ø)

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 merged commit 5ab95aa into apache:master Apr 3, 2024
40 checks passed
@john-bodley john-bodley deleted the john-bodley--jinja-sql-strip branch April 3, 2024 00:08
@john-bodley john-bodley changed the title chore(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction fix(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction Apr 3, 2024
@john-bodley john-bodley changed the title fix(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction chore(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction Apr 3, 2024
@michael-s-molina michael-s-molina added v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch labels Apr 3, 2024
michael-s-molina pushed a commit that referenced this pull request Apr 3, 2024
jzhao62 pushed a commit to jzhao62/superset that referenced this pull request Apr 4, 2024
EandrewJones pushed a commit to UMD-ARLIS/superset that referenced this pull request Apr 5, 2024
michael-s-molina pushed a commit that referenced this pull request Apr 8, 2024
EnxDev pushed a commit to EnxDev/superset that referenced this pull request Apr 12, 2024
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 28, 2024
@mistercrunch mistercrunch added 🍒 3.1.3 🍒 4.0.1 🍒 4.0.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Jul 2, 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 v3.1 Label added by the release manager to track PRs to be included in the 3.1 branch v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🍒 3.1.3 🍒 4.0.1 🍒 4.0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants