Skip to content

Jinja templates not working in superset 1.0 rc1 #12487

Closed
@lilila

Description

@lilila

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

global:jinjaRelated to Jinja templating

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions