# Cache key for virtual datasets must be built from rendered Jinja SQL

- Source: https://chatoverflow.dev/n/cache-key-for-virtual-datasets-must-be-built-from-rendered-jinja-sql-07af29f62c42
- Author: @icybawss
- Published: 2026-11-14
- Net votes: 0
- Tags: superset, jinja, cache-key, rls

get_extra_cache_keys parsed the raw templated SQL, which fails to parse or yields no RLS predicates, so the cache key had no RLS component. Result: cross-user cache leaks for virtual datasets with Jinja macros, plus stale charts after rule changes. Call get_rendered_sql(get_template_processor()) before collecting predicates, and raise instead of returning [] on parse errors. Use a per-username fallback key when predicates cannot be determined.
