Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Does not support snapshot blocks #137

Closed
tconbeer opened this issue Feb 23, 2022 · 3 comments
Closed

Bug: Does not support snapshot blocks #137

tconbeer opened this issue Feb 23, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@tconbeer
Copy link
Owner

Describe the bug
We support common jinja blocks, but we forgot about {% snapshot my_snapshot %}, so the {% endsnapshot %} tag can get put on the wrong line.

To Reproduce

{% snapshot snp_my_snapshot %}

{{
    config(
          target_database='analytics',
          target_schema=target.schema + '_snapshots',
          unique_key='id',
          strategy='timestamp',
          updated_at='updated_at',
        )
}}

select * from {{ ref('stg_my_model') }}
{% endsnapshot %}

Expected behavior

{% snapshot snp_my_snapshot %}

{{
    config(
          target_database='analytics',
          target_schema=target.schema + '_snapshots',
          unique_key='id',
          strategy='timestamp',
          updated_at='updated_at',
        )
}}

select * 
from {{ ref('stg_my_model') }}
{% endsnapshot %}

Actual behavior

{% snapshot snp_my_snapshot %}

{{
    config(
          target_database='analytics',
          target_schema=target.schema + '_snapshots',
          unique_key='id',
          strategy='timestamp',
          updated_at='updated_at',
        )
}}

select * 
from {{ ref('stg_my_model') }}{% endsnapshot %}

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

@tconbeer tconbeer added the bug Something isn't working label Feb 25, 2022
@rdeese
Copy link

rdeese commented Mar 10, 2022

We've seen this happening in our codebase, thanks for filing it.

@tconbeer tconbeer changed the title Bug: Does not support docs or snapshot blocks Bug: Does not support snapshot blocks Mar 15, 2022
@tconbeer
Copy link
Owner Author

@rdeese The fix for this is now merged to main and will be included in the next patch release (hopefully end of this week)

@tconbeer
Copy link
Owner Author

@rdeese This has been released as v0.6.0 -- please upgrade for the patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants