jinja2apache-superset

Superset enable jinja


I need to enable jinja in Superset.

I found that I have to set ENABLE_TEMPLATE_PROCESSING to true. I found it in the config.py that has the default value that was as false. But also someone said that I can set it in the superset_config.py which overwrite the default config.py value.

But in the superset_config.py there is not somewhere ENABLE_TEMPLATE_PROCESSING. Is this that the default value in the config.py will prevail? In the superset_config.py found the

list: FEATURE_FLAGS = {"ALERT_REPORTS": True}

so I guess if I add in this list the "ENABLE_TEMPLATE_PROCESSING" then it will supersede the config.py.

Ι kept the default. So is there a simple way to test it in the SQL Lab? Have to restart the application (superset_app) to take effect? It runs in a docker container. I found the

select {{current_user_id()}} my_userid;

to test it but it throws

Please check your query for syntax errors at or near "{". Then, try running your query again."

This means jinja is not enabled.


Solution

  • In the superset_config.py change the dictionary FEATURE_FLAGS = {"ALERT_REPORTS": True} to FEATURE_FLAGS = {"ALERT_REPORTS": True; "ENABLE_TEMPLATE_PROCESSING":True}. The only difference is that you add "ENABLE_TEMPLATE_PROCESSING":True in the dictionary. If you are in a docker don't forget to restart the superset_app container