question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jinja templating not working (1.2.0-rc2) requires undocumented config

See original GitHub issue

Expected results

Following documentation, running for instance this query should work (from sql lab)

SELECT  *
FROM mytable
WHERE username = '{{ current_username() }}'

should work and return results.

Actual results

{{ current_username() }} is not interpreted at all, is considered as a String. Hence the result does not work.

Note that '{{ url_param('myparam') }}' does not work either

looks like no templating interpretation is done.

Used to work fine in 0.38

Does not work in 1.2.0-RC2

I don’t know where to look for detailed executions logs. I had a look un query table of superset schema, query was not traced interpreted there but maybe it’s the expected result.

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

  1. Go to ‘SQL Lab’
  2. Enter a query using Jinja templating
  3. See issue

Environment

(please complete the following information):

  • superset version: Superset 1.2.0 (1.2.0-RC2 actually)
  • python version: Python 3.7.9
  • node.js version: not present in container

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
maltozecommented, Jun 22, 2021

Hope this can help. #15246

1reaction
squaloucommented, Jun 21, 2021

for the records, this works in superset_config.py

It should really be added here : https://superset.apache.org/docs/installation/sql-templating

FEATURE_FLAGS = {
    "ENABLE_TEMPLATE_PROCESSING": True
}

BUT it still doesn’t work in SQL LAB. It works when used elsewhere

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template Designer Documentation - Jinja
The template syntax is heavily inspired by Django and Python. Below is a minimal template that illustrates a few basics using the default...
Read more >
Visual Studio Code and Jinja templates - Stack Overflow
2 I've install the Better Jinja extension thx to cricket_007. To make it work, I need to select jinja html in the bottom...
Read more >
Jinja2 Documentation - Read the Docs
This is the documentation for the Jinja2 general purpose templating language. Jinja2 is a library for Python that is designed to be flexible ......
Read more >
Jinja2 - PyPI
Jinja is a fast, expressive, extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax.
Read more >
Understanding Jinja - Salt Project Documentation
This would import the test template variable or macro, not the test state element, ... Fuzzy dates require the timelib Python module is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found