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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
