You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Pegoku (via GitHub)" <gi...@apache.org> on 2025/11/04 18:48:24 UTC
[I] Native filters with Jinja SQL unable to load when GLOBAL_ASYNC_QUERIES is enabled [superset]
Pegoku opened a new issue, #35991:
URL: https://github.com/apache/superset/issues/35991
### Bug description
I have a dashboard with multiple filters with an SQL dataset, and it has Jinja templating in it. It uses Roles to know which options to display.
It seems when enabling GLOBAL_ASYNC_QUERIES and caching, they get stuck. In the Developer Tools, I can see some requests' status being 422 (UNPROCESSABLE ENTITY).
In the Superset LOGS, I get many warning like this:
`WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key cd1790a05631bea74a503cad6e640372`
### Screenshots/recordings
<img width="853" height="720" alt="Image" src="https://github.com/user-attachments/assets/0ed58635-3e5b-4857-a7ea-876ef91ef5aa" />
### Superset version
master / latest-dev
### Python version
3.11
### Node version
18 or greater
### Browser
Firefox
### Additional context
Part of the SQL where Jinja templating is used:
```
WHERE
{% if 'AllEmpresas' in current_user_roles() %}
1 = 1
{% elif current_user_empresas() and current_user_empresas()|length > 0 %}
VGJ.CodigoEmpresa IN {{ current_user_empresas() | where_in }}
{% else %}
1 = 0
{% endif %}
```
### 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.
- [x] 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] Native filters with Jinja SQL unable to load when GLOBAL_ASYNC_QUERIES is enabled [superset]
Posted by "Pegoku (via GitHub)" <gi...@apache.org>.
Pegoku commented on issue #35991:
URL: https://github.com/apache/superset/issues/35991#issuecomment-3487638630
As it seems to be a known issue, I'll just close the issue.
--
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] Native filters with Jinja SQL unable to load when GLOBAL_ASYNC_QUERIES is enabled [superset]
Posted by "Pegoku (via GitHub)" <gi...@apache.org>.
Pegoku closed issue #35991: Native filters with Jinja SQL unable to load when GLOBAL_ASYNC_QUERIES is enabled
URL: https://github.com/apache/superset/issues/35991
--
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] Native filters with Jinja SQL unable to load when GLOBAL_ASYNC_QUERIES is enabled [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #35991:
URL: https://github.com/apache/superset/issues/35991#issuecomment-3487557906
<!-- Answer -->
This is a known bug in Superset when GLOBAL_ASYNC_QUERIES is enabled and Jinja SQL queries reference dashboard-level filters. The root cause is inconsistent cache key serialization between the Celery worker and the web UI, which leads to HTTP 422 errors and cache missesāresulting in native filters getting stuck and not loading. Superset logs with warnings like `force_cached (QueryContext): value not found for key ...` are a symptom of this issue.
There are currently two workarounds: you can disable async queries by setting `GLOBAL_ASYNC_QUERIES = False` (which impacts scalability), or use `url_param('param', add_to_cache_keys=False)` in your Jinja (but this breaks filtering functionality). There is no official fix yet. For dynamic SQL logic, it's recommended to use CASE WHEN statements or virtual datasets instead of Jinja templating in chart filters to avoid this problem. More details are available in [this issue](https://github.com/apache/superset/issues/35226).
<!-- 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/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=hallucination) | [Report š](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6b9681ff-7d5a-440a-808f-90b3ab42ff13?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
b) [](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/issues/35991)
--
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