dosubot[bot] commented on issue #35226:
URL: https://github.com/apache/superset/issues/35226#issuecomment-3317426904

   <!-- Greeting -->
   Hi @rahul-plavelimana! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m 
helping the superset team.
   
   <!-- Answer -->
   This is a known bug in Superset when using async queries with Jinja SQLs and 
dashboard-level filters: enabling `GLOBAL_ASYNC_QUERIES` causes HTTP 422 errors 
due to inconsistent cache key serialization between the Celery worker (which 
writes the cache) and the web UI (which reads it). This mismatch happens 
especially when multiple URL parameters or Jinja filters are involved, so the 
cache key generated during async execution doesn't match the one used for 
retrieval, even though the result exists in Redis. See [issue 
#34543](https://github.com/apache/superset/issues/34543) for details.
   
   Workarounds are limited: disabling async (`GLOBAL_ASYNC_QUERIES = False`) 
avoids the bug but sacrifices scalability; using `url_param('param', 
add_to_cache_keys=False)` can bypass the error but breaks filtering, since the 
cache key no longer reflects filter values. There’s no official fix as of now, 
and the bug persists in master/latest-dev. If you need async and dynamic Jinja 
filters, you may need to limit to single-parameter filters or monitor for 
upstream changes. Advanced users can explore a custom patch to serialize URL 
parameters in a canonical way for cache keys—see the code paths in 
`superset/jinja_context.py`, `superset/common/query_object.py`, and 
`superset/connectors/sqla/models.py` for where this logic lives 
[source](https://github.com/apache/superset/issues/34543).
   
   For dynamic SQL logic, consider moving conditional logic into the main SQL 
query using CASE WHEN or virtual datasets, as Jinja templating in chart filters 
is no longer supported in recent versions 
[source](https://github.com/apache/superset/issues/34264).
   
   
   <!-- 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/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/cd033b53-661b-455f-82ca-fc2444821ce9?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=githu
 b)&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/issues/35226)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to