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> [](https://go.dosu.dev/discord-bot) [! [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-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org