Bug description
- Use version 5.0 of superset
- Enable the ENABLE_TEMPLATE_PROCESSING flag
- Connect to the pg database of superset itself. When querying in the SQL lab, use the statement "SELECT '{{ current_username()}}' AS current_user;" The result will be "{{ current_username()}}". Note: The same issue exists when executing in the MySQL data source.
Screenshots/recordings
No response
Superset version
5.0.0
Python version
I don't know
Node version
I don't know
Browser
Chrome
Additional context
No response
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.
Comment From: dosubot[bot]
Hi @2873377152! I'm Dosu and I’m helping the superset team.
Jinja template processing in Superset 5.0.0 is controlled by the ENABLE_TEMPLATE_PROCESSING
feature flag, which is set to False
by default and must be explicitly enabled in your configuration (usually in superset_config.py
). When enabled, SQL Lab queries should be processed by the Jinja engine, rendering functions like {{ current_username() }}
to the actual username, regardless of the database backend—including Postgres and MySQL. There is no code or documentation indicating that Jinja processing is intentionally disabled for the metadata database or specific engines in SQL Lab for this version (source, source).
If you see literal template strings in your results, the most likely causes are:
- The feature flag is not set or not loaded correctly at runtime (e.g.,
superset_config.py
is not being picked up, or the flag is set in the wrong place). - There is an environment/context initialization issue (such as multiple Superset processes, config file placement, or containerization problems).
- There is a regression or bug not yet tracked in the issue tracker.
Troubleshooting steps:
1. Double-check that ENABLE_TEMPLATE_PROCESSING
is set to True
in your superset_config.py
and that this config file is being loaded by your Superset instance.
2. Restart all Superset processes after changing the config to ensure the flag is picked up.
3. Check the logs for any warnings or errors related to template processing or config loading.
4. If you are running Superset in containers, make sure the config file is mounted and available in all containers.
5. Try running a query with a simple Jinja template and see if it renders when you provide template parameters (e.g., SELECT '{{ state }}'
with {"state": "CA"}
as template params).
Integration tests for Superset 5.0.0 confirm that Jinja template processing works in SQL Lab when the flag is enabled (source), so if it’s not working for you, it’s likely a configuration or environment issue rather than an intentional limitation or known bug.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other