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 templates not working in superset 1.0 rc1

See original GitHub issue

Queries using Jinja variables are not working anymore in Superset 1.0 rc1.

For instance I have a dataset defined as follows :

{% set title_target = ' "'  + filter_values("title_target", 'Joker')[0] + '" ' %}
{% set title_type =  'title' %}

{% if filter_values('title_target_original')|length > 0 %}
    {% set title_target =  ' "'  + filter_values("title_target_original", 'Joker')[0] + '" ' %}
    {% set title_type =  'title_original' %}
{% endif %}


SELECT {{title_target}} AS title_to_display

I use to work well but now I receive the following error:

Error: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'%\n set title_target = \' "\' + filter_values("title_target", \'Joker\')[0] + \'" \' \' at line 4')

If I move the Jinja parameters in the “template parameters” section:

Screenshot 2021-01-13 at 08 09 06

I receive the following error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
villebrocommented, Jan 13, 2021

@lilila I’m not able to reproduce the first case - I assume you’ve enabled the template processing feature flag?

FEATURE_FLAGS = {
    "ENABLE_TEMPLATE_PROCESSING": True,
}

See #11172

4reactions
mona-mkcommented, Jul 1, 2021

I think the correct place with docker nowadays is here: Screenshot 2021-07-01 at 11 27 34

Read more comments on GitHub >

github_iconTop Results From Across the Web

subject:"\[GitHub\] \[superset\] abhiroop93 ... - The Mail Archive
[GitHub] [superset] abhiroop93 commented on issue #12487: Jinja templates not working in superset 1.0 rc1 · 2021-04-30 Thread GitBox.
Read more >
Intro To Jinja Templating in Apache Superset™ | Preset
Learn more about Jinja Templating, SQL Templating with Jinja in Superset, pre-defined macros, use-cases, and a walkthrough of an example!
Read more >
SQL Templating - Apache Superset
Jinja Templates​ SQL Lab and Explore supports Jinja templating in queries. To enable templating, the ENABLE_TEMPLATE_PROCESSING feature flag needs to be ...
Read more >
UPDATING.md · Gitee 极速下载/Superset
Updating Superset. This file documents any backwards-incompatible changes in Superset and assists people when migrating to a new version.
Read more >
Release 7.23.1 The IPython Development Team
Python code development and for exploration of problems using ... Added support for configurable user-supplied Jinja HTML templates for the ...
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