You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "2873377152 (via GitHub)" <gi...@apache.org> on 2025/11/17 23:28:07 UTC

[D] Version 5.0.0: Jinja Templates are unavailable [superset]

GitHub user 2873377152 created a discussion: Version 5.0.0: Jinja Templates are unavailable

### Bug description

1. Use version 5.0 of superset
2. Enable the ENABLE_TEMPLATE_PROCESSING flag
3. 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.

GitHub link: https://github.com/apache/superset/discussions/36147

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] Version 5.0.0: Jinja Templates are unavailable [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Version 5.0.0: Jinja Templates are unavailable

<!-- Greeting -->
Hi @2873377152! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.

<!-- Answer -->
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](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py), [source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py)).

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](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/tests/integration_tests/sqllab_tests.py)), so if it’s not working for you, it’s likely a configuration or environment issue rather than an intentional limitation or known bug.


<!-- 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/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/15278759-df27-4120-848c-4e6bc0ecd96c?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=github)&
 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/35025)

GitHub link: https://github.com/apache/superset/discussions/36147#discussioncomment-14995107

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] Version 5.0.0: Jinja Templates are unavailable [superset]

Posted by "maksir (via GitHub)" <gi...@apache.org>.
GitHub user maksir added a comment to the discussion: Version 5.0.0: Jinja Templates are unavailable

The same error whit config:
"ENABLE_TEMPLATE_PROCESSING": True

but this config  works for me:

FEATURE_FLAGS = {
    "ENABLE_TEMPLATE_PROCESSING": True,
}

GitHub link: https://github.com/apache/superset/discussions/36147#discussioncomment-14995108

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] Version 5.0.0: Jinja Templates are unavailable [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
GitHub user rusackas added a comment to the discussion: Version 5.0.0: Jinja Templates are unavailable

Yep, this should be working as suggested, when the feature flag is enabled in the right spot. Are you still facing this @2873377152 ?

GitHub link: https://github.com/apache/superset/discussions/36147#discussioncomment-14995109

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org