What you want to achieve can be done with the following script
{% set n = 3 %} {% for i in range(n): %} {% if i == 0 %} SELECT {{i}} {% else %} UNION ALL SELECT {{i}} {% endif %} {% endfor %}