You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "yousoph (via GitHub)" <gi...@apache.org> on 2025/06/13 22:58:12 UTC

[I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

yousoph opened a new issue, #33773:
URL: https://github.com/apache/superset/issues/33773

   ### Bug description
   
   ## Description
   Dashboard charts that are powered by Jinja are able to display their data correctly. However, when users try to perform the drill-by action, the result is incorrect.
   
   ## How to reproduce the bug
   1. By following [**this guide**](https://preset.io/blog/intro-jinja-templating-apache-superset/#using-jinja-to-filter-data-walkthrough), create a Jinja-powered dataset with `country`, `status`, and `product_line` columns.
   2. Create a stacked Bar Chart and add it to a dashboard.
   3. Add a filter for the Product Line from the `Vehicle Sales` dataset.
   4. Ensure that the dashboard shows correct data.
   5. On the stacked Bar Chart, perform a **drill to detail by all** action.
   
   ## Expected results
   Drill-by results are correct.
   
   ## Actual results
   Drill-by results are incorrect.
   
   ## Known Workarounds
   No workarounds are currently known.
   
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
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.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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz closed issue #33773: Drill to Detail is not working properly on Charts powered by Jinja Templating
URL: https://github.com/apache/superset/issues/33773


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "syedbarimanjan (via GitHub)" <gi...@apache.org>.
syedbarimanjan commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3016401184

   @yousoph I followed the guide but couldnt reproduce the issue it is working fine on my end could you provide some more info into it specifically the jinja template.
   
   Here is my jinja template 
   ```
   WITH calculation as (
     SELECT count(*), country
     FROM "cleaned_sales_data"
     WHERE 1=1
     {% if filter_values('product_line') %}
       and product_line in {{ filter_values('product_line')|where_in }}
     {% else %}
       and product_line = 'Classic Cars'
     {% endif %}
     GROUP BY country
   )
   SELECT * FROM calculation
   ````


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "syedbarimanjan (via GitHub)" <gi...@apache.org>.
syedbarimanjan commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3005153871

   @msyavuz I would like to work on this can you assign it to me. Thanks
   


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-2971917946

   <!-- Answer -->
   This issue is caused by a disconnect between the context available to Jinja templates during regular chart rendering and what is provided during drill-to-detail actions. When you drill, the frontend sends a new request that often lacks the full dashboard/global context (like dashboard filters or URL params) that your Jinja SQL expects, so the template renders incorrectly or with missing values. This is a known limitation and has been discussed in several issues and code reviews ([example](https://github.com/apache/superset/issues/33591), [example](https://github.com/apache/superset/issues/33579)).
   
   A workaround is to make your Jinja SQL more robust by using `if/else` blocks to provide default values when filters are missing, so the query always returns results and columns don't disappear. For example:
   
   ```sql
   WITH calculation as (
     SELECT count(*), country
     FROM "Vehicle Sales"
     WHERE 1=1
     {% if filter_values('product_line') %}
       and product_line in {{ filter_values('product_line')|where_in }}
     {% else %}
       and product_line = 'Classic Cars'
     {% endif %}
     GROUP BY country
   )
   SELECT * FROM calculation
   ```
   ([source](https://github.com/apache/superset/issues/33591))
   
   If your dataset relies on dashboard-level filters or variables, you may need to adjust your Jinja logic to handle cases where those are missing during drill actions.
   
   There have also been recent changes to how Superset syncs dataset columns and processes Jinja templates, which can impact this behavior ([PR 30903](https://github.com/apache/superset/pull/30903)). Make sure your configuration enables `ENABLE_TEMPLATE_PROCESSING` and that your feature flags are up to date.
   
   At this time, there is no full workaround for preserving all dashboard context in drill-to-detail requests, but making your Jinja SQL more defensive can help avoid empty or broken results.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b69c1718-3168-4773-8010-e1b0c5b3a852?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33773)


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3005220407

   @Nandu9494 Can we chat on [slack](https://join.slack.com/t/apache-superset/shared_invite/zt-2be0drwz8-bxPfkdz28ozzk1Iox29ufg)? We have a channel for bounties.


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "Nandu9494 (via GitHub)" <gi...@apache.org>.
Nandu9494 commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3004793717

   @geido I would like to take this, Please assign to me


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "syedbarimanjan (via GitHub)" <gi...@apache.org>.
syedbarimanjan commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3030542894

   @yousoph any update on this?


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3004649157

   ---
   
   ### 🎉 **Preset Bounty Available: $250 USD** 🎉
   
   To claim this bounty, please carefully follow the steps below.
   
   ---
   
   #### 📋 **Steps to Participate**
   
   1. **Review Guidelines:**  
      Read through the [Preset Bounty Program Contribution Guide](https://preset.notion.site/preset-bounty-program-apache-superset) for complete details on bounty requirements.
   
   2. **Show Your Interest:**  
      Complete the [Preset Bounty Program Survey](https://docs.google.com/forms/d/e/1FAIpQLSeDsR1iWvPxFydUIXs2agsUg3kMDaAooeD4P9P1L5sI0Yu5QQ/viewform?usp=sharing) and comment this issue to express your interest.
   
   3. **Join the Slack Channel:**  
      After completing the survey, you’ll receive an invitation to the dedicated [Apache Superset Slack](https://join.slack.com/t/apache-superset/shared_invite/zt-2be0drwz8-bxPfkdz28ozzk1Iox29ufg) channel.
   
   4. **Get Assigned:**  
      To officially start, ensure a **Bounty Program Manager** has assigned you to this issue.
   
   5. **Submit Your Solution:**  
      When ready, submit your solution with the `Fixes #{issue_number}` notation in your Pull Request description.
   
   6. **Claim Your Bounty:**  
      Sign up at [GitPay.me](https://gitpay.me/) and submit your solution via: [https://gitpay.me/#/task/1211](https://gitpay.me/#/task/1211)
   
   ---
   
   #### 💡 **Additional Notes**
   
   - Only developers assigned by a **Bounty Program Manager** should start working on this issue to win the bounty.
   - Be sure to follow the guide closely to avoid any delays in payment. Please, allow a few days after your PR has been merged for the bounty to be released.
   
   Good luck, and happy coding! 🎉


-- 
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


Re: [I] Drill to Detail is not working properly on Charts powered by Jinja Templating [superset]

Posted by "syedbarimanjan (via GitHub)" <gi...@apache.org>.
syedbarimanjan commented on issue #33773:
URL: https://github.com/apache/superset/issues/33773#issuecomment-3030543412

   @yousoph any update on this?


-- 
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