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: KeyError 'sql' when opening a Trino virtual dataset #30339

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

michael-s-molina
Copy link
Member

SUMMARY

#27470 modified the logic to validate a SQL Lab query by checking the access permission before any Jinja rendering occurs as some Jinja macros execute statements upon rendering. Those changes left an unused shallow copy statement that was interfering with SQL Alchemy internal state provoking key errors. This PR removes the unused statements.

Fixes #30338

TESTING INSTRUCTIONS

Follow the instructions described in the original issue.

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

@dosubot dosubot bot added global:jinja Related to Jinja templating sqllab Namespace | Anything related to the SQL Lab labels Sep 19, 2024
@@ -90,7 +90,6 @@ def execute(
rendered_query: str,
log_params: dict[str, Any] | None,
) -> SqlJsonExecutionStatus:
print(">>> execute <<<")
Copy link
Member Author

Choose a reason for hiding this comment

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

Leftovers from the original PR.

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.89%. Comparing base (76d897e) to head (2bded1e).
Report is 1094 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #30339       +/-   ##
===========================================
+ Coverage   60.48%   83.89%   +23.41%     
===========================================
  Files        1931      533     -1398     
  Lines       76236    38489    -37747     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    32292    -13822     
+ Misses      28017     6197    -21820     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 49.00% <ø> (-0.16%) ⬇️
javascript ?
mysql 76.86% <ø> (?)
postgres 76.94% <ø> (?)
presto 53.51% <ø> (-0.30%) ⬇️
python 83.89% <ø> (+20.41%) ⬆️
sqlite 76.38% <ø> (?)
unit 60.61% <ø> (+2.98%) ⬆️

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.

@michael-s-molina michael-s-molina added the v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch label Sep 19, 2024
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the cleanup (seems the original PR was slightly rushed 😬)

@michael-s-molina michael-s-molina merged commit ef9e5e5 into apache:master Sep 19, 2024
38 checks passed
sadpandajoe pushed a commit that referenced this pull request Sep 19, 2024
@github-actions github-actions bot added 🍒 4.1.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Nov 14, 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 global:jinja Related to Jinja templating size/XS sqllab Namespace | Anything related to the SQL Lab v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch 🍒 4.1.0 🍒 4.1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyError: 'sql' when opening a Trino virtual dataset that contains latest_partition on SQL Lab
3 participants