Parameterising the dbt model. Variable (SQL in clause)

Of course, try something like

{% set country_code_list = var('country_code') %}

select *
from abc
where country_conde in (
{% for code in country_code_list %}
    {% if not loop.last %}
        {{ code }},
    {% else %}
        {{ code }}
    {% endif %}
{% endfor %}
)

You have to manipulate the list with jinja functions

1 Like