Jinja

Jinja is the template language used by dbt to make SQL dynamic: variables, conditions, loops and function calls. Expressions are written between {{ }} and statements between {% %}. dbt evaluates the Jinja at compile time, then sends plain SQL to the warehouse.

Example

{% for m in ['cb', 'paypal'] %}
sum(case when moyen = '{{ m }}' then montant end) as ca_{{ m }},
{% endfor %}

Related concepts

The whole glossary