GitHub user dosubot[bot] added a comment to the discussion: warm_up_cache API doesn't apply filters when the dataset uses the filter_values Jinja macro
<!-- Answer --> You're right—providing dashboard_id should, in theory, merge extra_filters into form_data so that filter_values works in your Jinja SQL, but there are edge cases in the code that can break this. For legacy (non-query_context) charts, extra_filters are merged into form_data and processed by filter_values, but for query_context-based charts, extra_filters are not merged the same way and may not reach the Jinja context, which could explain why your workaround isn't working for all chart types [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/chart/warm_up_cache.py). Other possible causes include: race conditions (if get_form_data is called before extra_filters are set), unexpected merges if the DB slice's form_data already contains extra_filters, or differences in structure between dashboard and API-supplied extra_filters [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py). As a practical workaround, you can use an if/else block in your SQL to provide a default value when filter_values returns empty, ensuring your query always returns results. If you need cache warmup to work for all chart types, you may need to patch the logic to always merge extra_filters into form_data, or restructure your filters to avoid relying on filter_values in this context. Let me know if you want help identifying chart types or validating form_data structure for your setup. <!-- 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/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3af232ca-7cf6-458d-ad9e-173346fba5be?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34979) GitHub link: https://github.com/apache/superset/discussions/34979#discussioncomment-14286187 ---- This is an automatically sent email for notifications@superset.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@superset.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org