dosubot[bot] commented on issue #33775: URL: https://github.com/apache/superset/issues/33775#issuecomment-2979545649
<!-- Answer --> You're right—there's a disconnect between the docs and the current implementation. The docs say `cache_key_wrapper()` is for wrapping custom function return values, but the regex in the code now only allows simple, non-nested expressions (like a single variable or property accessor) inside `cache_key_wrapper`, not function calls with parentheses or any nested expressions. So, in practice, you can't use it to wrap the result of a function call like `current_user_campus_ids()` anymore—only something like `cache_key_wrapper(variable)` will work, which is pretty limiting for dynamic use cases like yours. I agree that the regex should be more lenient to match the documented intent and real-world needs. Right now, the only way around this is to monkey patch the `ExtraCache` processor or revert the regex change, since there's no config or extension point for this part of the logic. No relevant discussions or plans to relax the regex have come up in the repo or docs so far. If you need this flexibility, advocating for a change to the regex or opening a discussion about restoring support for nested calls would be reasonable next steps. For now, the restriction is hardcoded and not aligned with the documentation or common Jinja usage patterns. [Reference: implementation and regex restriction](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset/jinja_context.py) [Reference: docs on intended usage](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/docs/docs/configuration/sql-templating.mdx) <!-- 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/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/17b0dead-3e18-4e03-94b8-308c044956de?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [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/33775) -- 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]
