GitHub user dosubot[bot] added a comment to the discussion: Overcoming URL 
length limits when using url_param Jinja injection in Embedded SDK

<!-- Answer -->
Superset doesn't natively support hydrating url_param Jinja values from a 
server-side store like Redis or via a secondary POST request—url_param only 
reads from the request query string or form_data["url_params"] passed in the 
request 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py#L77-L775)].
 However, your proposed pattern—overriding url_param via JINJA_CONTEXT_ADDONS 
in superset_config.py to intercept a key and fetch the full filter list from 
Redis—is feasible and aligns with how Superset allows custom Jinja context 
injection 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py#L498-L2008)].

This approach is not officially documented but is the recommended way to 
implement custom logic if you need to bypass URL length limits. Just be mindful 
of security and operational risks: ensure keys are unguessable, set appropriate 
TTLs to avoid stale data, and consider user isolation if filters are sensitive.

There is no built-in feature to hydrate url_param from permalinks or 
form_data_key, but Superset does support server-side caching of form_data 
(including url_params) referenced by a short key in the URL. This is used for 
dashboard and explore state, but you'd need to structure your embedding to 
leverage this mechanism for your use case 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/core.py#L350-L860)].

A community workaround for large filter lists is to encode multiple values into 
a single URL parameter using delimiters (like tilde and comma) and parse them 
in Jinja, but this only partially mitigates URL length issues for very large 
payloads [[source](https://github.com/apache/superset/issues/34543)].

If you proceed with the Redis-backed pattern, monitor for cache key mismatches 
and async query issues, as there are known bugs with multi-parameter Jinja 
filters and async caching in embedded dashboards 
[[source](https://github.com/apache/superset/issues/34543#issuecomment-3153246318)].


<!-- 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/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/316d1d9a-dd26-43c3-a2f7-80d86eec2cc1?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Superset%20doesn%27t%20natively%20support%20hydrating%20url_param%20Jinja%20values%20from%20a%20server-side%20store%20like%20Redis%20or%20via%20a%20secondary%20POST%20request%E2%80%94url_param%20only%20reads%20from%20the%20request%20query%20string%20or%20form_data%5B%22url_params%22%5D%20passed%20in%20the%20request%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py%23L77-L775%29%5D.%20However%2C%20your%20proposed%20pattern%E2%80%94overriding%20url_param%20via%20JINJA_CONTEXT_ADDONS%20in%20superset_config.py%20to%20intercept%20a%20key%20and%20fetch%20the%20full%20filter%20list%20from%20Redis%E2%80%94is%20feasible%20and%20aligns%20with%20how%20Superset%20allows%20custom%20Jinj
 
a%20context%20injection%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py%23L498-L2008%29%5D.%0A%0AThis%20approach%20is%20not%20officially%20documented%20but%20is%20the%20recommended%20way%20to%20implement%20custom%20logic%20if%20you%20need%20to%20bypass%20URL%20length%20limits.%20Just%20be%20mindful%20of%20security%20and%20operational%20risks%3A%20ensure%20keys%20are%20unguessable%2C%20set%20appropriate%20TTLs%20to%20avoid%20stale%20data%2C%20and%20consider%20user%20isolation%20if%20filters%20are%20sensitive.%0A%0AThere%20is%20no%20built-in%20feature%20to%20hydrate%20url_param%20from%20permalinks%20or%20form_data_key%2C%20but%20Superset%20does%20support%20server-side%20caching%20of%20form_data%20%28including%20url_params%29%20referenced%20by%20a%20short%20key%20in%20the%20URL.%20This%20is%20used%20for%20dashboard%20and%20explore%20state%2C%20but%20you%27d%20need%20to%20structure%20your%20embedding%20to%20levera
 
ge%20this%20mechanism%20for%20your%20use%20case%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/views/core.py%23L350-L860%29%5D.%0A%0AA%20community%20workaround%20for%20large%20filter%20lists%20is%20to%20encode%20multiple%20values%20into%20a%20single%20URL%20parameter%20using%20delimiters%20%28like%20tilde%20and%20comma%29%20and%20parse%20them%20in%20Jinja%2C%20but%20this%20only%20partially%20mitigates%20URL%20length%20issues%20for%20very%20large%20payloads%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34543%29%5D.%0A%0AIf%20you%20proceed%20with%20the%20Redis-backed%20pattern%2C%20monitor%20for%20cache%20key%20mismatches%20and%20async%20query%20issues%2C%20as%20there%20are%20known%20bugs%20with%20multi-parameter%20Jinja%20filters%20and%20async%20caching%20in%20embedded%20dashboards%20%5B%5Bsource%5D%28https%3A//github.com/apache/superset/issues/34543%23issuecomment-3153246318%29%5D.)&nbsp;[![Join
 Disco
 
rd](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/37132)

GitHub link: 
https://github.com/apache/superset/discussions/37132#discussioncomment-15495156

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