Skip to content

for...else...endfor statement does not work #549

Closed
@yassun7010

Description

@yassun7010

Describe the bug
for...else...endfor statements does not support.

I have verified that it works correctly in jinja sandbox.

To Reproduce
The following code fails on sandbox.

{% for i in range(5) %}
    select 1
{% else %}
    select 2
{% endfor %}

Expected behavior

    select 1

    select 1

    select 1

    select 1

    select 1

Actual behavior
The following error occur.

sqlfmt encountered an error: Closing jinja tag '{% endfor %}' found at pos 61 does not match last opened tag '{% else %}' found at pos 37.

Additional context
What is the output of sqlfmt --version?

sqlfmt, version 0.21.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions