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

<!-- Greeting -->
Hi @pandax08! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.

<!-- Answer -->
This is a known limitation in the current implementation of the 
/api/v1/dataset/warm_up_cache endpoint. The extra_filters you send are only 
merged into the chart's form_data—and thus made available to the filter_values 
Jinja macro—if a dashboard_id is provided. If dashboard_id is missing or not 
handled as expected, extra_filters are ignored, which causes filter_values to 
always return an empty list in your virtual dataset SQL. This explains why your 
filters are not applied during cache warming, even though they work in other 
contexts.

This behavior is likely an unintentional bug or omission in the cache warming 
logic. The code path for warm_up_cache only attaches extra_filters to form_data 
when dashboard_id is present, and does not merge them otherwise, so the Jinja 
context never sees your filters. No recent pull requests address this issue 
yet, so it's not fixed in the latest versions 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/chart/warm_up_cache.py)].

As a workaround, always provide a valid dashboard_id in your API call, and 
ensure that the charts you want to warm up are associated with that dashboard. 
This should allow extra_filters to be merged and passed to filter_values as 
expected. If you need to warm up cache for charts not tied to a dashboard, you 
may need to manually trigger cache warming for each chart with the appropriate 
form_data, or consider patching the logic to always merge extra_filters 
regardless of dashboard context.

Let me know if you need more details on the workaround or want to discuss 
alternative strategies!


<!-- 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/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/c0d48b82-b2ad-4aa7-bcc6-865ee89edc96?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 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/discussions/34979)

GitHub link: 
https://github.com/apache/superset/discussions/34979#discussioncomment-14279806

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to