justinpark opened a new pull request, #34307:
URL: https://github.com/apache/superset/pull/34307
### SUMMARY
When running a query containing Jinja templates in SQL Lab, Airbnb uses the `extract_tables_from_jinja_sql` function to check permissions on the tables used in the query. However, if the template string includes undeclared variables, these are replaced with blanks, which can cause syntax errors.
<img width="755" height="538" alt="Screenshot 2025-07-24 at 3 52 00 PM" src="https://github.com/user-attachments/assets/86609833-63a6-42ec-baf8-7a72ab9dfafc" />
This issue has been addressed in the current master branch with [an improved parsing logic](https://github.com/apache/superset/pull/33564/files#diff-262aba4d8ec94601953bb91e7d86568f6c195458a56bee5e43db098f81fb9087R1425-R1427).
This commit updates only the relevant changes that were not included in version 5.0 of this logic.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No error thrown
### TESTING INSTRUCTIONS
Please design your security manager using extract_tables_from_jinja_sql and then run the following query
```
select * from table1 where column1 = {{ var1 }}
```
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
michael-s-molina merged PR #34307: URL: https://github.com/apache/superset/pull/34307 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org For queries about this service, please contact Infrastructure at: users@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org For additional commands, e-mail: notifications-help@superset.apache.org
codecov[bot] commented on PR #34307:
URL: https://github.com/apache/superset/pull/34307#issuecomment-3115285790
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/34307?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Please [upload](https://docs.codecov.com/docs/codecov-uploader) report for BASE (`5.0@fb035f4`). [Learn more](https://docs.codecov.io/docs/error-reference?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#section-missing-base-commit) about missing BASE report.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 5.0 #34307 +/- ##
======================================
Coverage ? 65.87%
======================================
Files ? 547
Lines ? 39953
Branches ? 0
======================================
Hits ? 26319
Misses ? 13634
Partials ? 0
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/34307/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/34307/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.85% <100.00%> (?)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/34307/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.33% <100.00%> (?)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/34307/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.87% <100.00%> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/34307/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.41% <100.00%> (?)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/34307?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org