GitHub user dosubot[bot] added a comment to the discussion: How to get all 
filters just by 1 api call?

<!-- Greeting -->
Hey @Zesshhi! 👋 I'm [Dosu](https://dosu.dev), your friendly bot here to help 
you tackle bugs, answer questions, and guide you towards becoming a 
contributor. I'm ready to assist while you wait for a human maintainer. Let's 
get started! 😊

<!-- Answer -->
Superset does not have a built-in mechanism to batch multiple filter requests 
into a single API call when they use the same dataset. Each filter typically 
results in a separate API call to the `api/v1/chart/data` endpoint, as you've 
observed. This is because each filter may require different query contexts or 
parameters, even if they are based on the same dataset.

To optimize this, you might consider implementing a custom solution that 
combines the filter logic on the client side before making a single API call. 
This would involve creating a unified query context that encompasses all the 
filters and sending it as a single request to the `api/v1/chart/data` endpoint. 
However, this approach would require significant customization and might not be 
straightforward due to the way Superset handles query contexts and data 
retrieval.

Additionally, caching can help reduce redundant API calls by storing filter 
states and reusing them when possible. Superset's caching mechanism, configured 
via `FILTER_STATE_CACHE_CONFIG`, can be leveraged to improve performance by 
caching filter states and reducing the need to repeatedly fetch the same data 
from the server 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/cache.mdx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/tests/integration_tests/cache_tests.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*

---
<sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/0406a792-61a1-4a95-b358-f2751db7aaa0?feedback_type=other)</sup>


GitHub link: 
https://github.com/apache/superset/discussions/33168#discussioncomment-12871451

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

Reply via email to