Skip to content

Conversation

LevisNgigi
Copy link
Contributor

@LevisNgigi LevisNgigi commented Sep 4, 2025

SUMMARY

This PR fixes a bug in SQL template processing when the ENABLE_TEMPLATE_PROCESSING feature flag is enabled.It handles undefined template variables gracefully by falling back to the original SQL.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

AFTER
template_processing

TESTING INSTRUCTIONS

Go to SQL Lab
Use the following query:
with ws1 as (
select 1 as one
)
select * from ws1 --{{ ref('value_date_delinquent_dates')|length }}
Run query
It should run successfully with no errors

ADDITIONAL INFORMATION

  • [ x] Has associated issue: Fixes Jinja templating from comments shows an error in SQL Lab #32044
  • 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 the global:jinja Related to Jinja templating label Sep 4, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Redundant Template Parsing ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset/sqllab/query_render.py
superset/jinja_context.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@LevisNgigi LevisNgigi changed the title fix template processing and handle undefined template variables safely in query rendering. fix: handle undefined template variables safely in query rendering. Sep 4, 2025
Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #117a57

Actionable Suggestions - 1
  • superset/jinja_context.py - 1
    • Unreliable exception handling with string matching · Line 701-701
Review Details
  • Files reviewed - 2 · Commit Range: 0702ac1..f112db5
    • superset/jinja_context.py
    • superset/sqllab/query_render.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Sep 4, 2025
@LevisNgigi LevisNgigi force-pushed the fix-template-processing branch from 9d016aa to a366d29 Compare September 4, 2025 08:36
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.23%. Comparing base (76d897e) to head (0d57680).
⚠️ Report is 2481 commits behind head on master.

Files with missing lines Patch % Lines
superset/jinja_context.py 40.00% 6 Missing ⚠️
superset/sqllab/query_render.py 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #35009       +/-   ##
===========================================
+ Coverage   60.48%   72.23%   +11.74%     
===========================================
  Files        1931      586     -1345     
  Lines       76236    42848    -33388     
  Branches     8568     4531     -4037     
===========================================
- Hits        46114    30951    -15163     
+ Misses      28017    10694    -17323     
+ Partials     2105     1203      -902     
Flag Coverage Δ
hive 46.68% <63.63%> (-2.47%) ⬇️
javascript ?
mysql 71.26% <63.63%> (?)
postgres 71.31% <63.63%> (?)
presto 50.35% <63.63%> (-3.46%) ⬇️
python 72.19% <63.63%> (+8.69%) ⬆️
sqlite 70.88% <63.63%> (?)
unit 100.00% <ø> (+42.36%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

bito-code-review bot commented Sep 4, 2025

Bito Automatic Review Failed - Technical Failure

Bito encountered technical difficulties while generating code feedback . To retry, type /review in a comment and save. If the issue persists, contact [email protected] and provide the following details:

Agent Run ID: 088a49dc-d665-4158-b594-ae5058d2bf5d

@rusackas rusackas requested a review from justinpark September 4, 2025 17:23
@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 5, 2025
Copy link
Contributor

bito-code-review bot commented Sep 5, 2025

Bito Automatic Review Failed - Technical Failure

Bito encountered technical difficulties while generating code feedback . To retry, type /review in a comment and save. If the issue persists, contact [email protected] and provide the following details:

Agent Run ID: c3274573-b84f-48ce-a99f-898b77d81325

@msyavuz msyavuz requested a review from justinpark September 5, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
global:jinja Related to Jinja templating size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jinja templating from comments shows an error in SQL Lab
2 participants