Search code examples
snapshotdbt

Encountered unknown tag 'snapshot' in DBT Snapshot


I want to run a DBT Snapshot and am following a near-identical template to the one outlined in the documentation. However, I get the error when I run dbt snpashot

Compilation Error in model test_snapshot (.../project_folder/snapshots/test_snapshot.sql)    
Encountered unknown tag 'snapshot'.
        line 1
          {% snapshot test_snapshot %}

Below is the code I am attempting to compile.

{% snapshot test_snapshot %}
    {{
        config(
            strategy='check',
            unique_key='id',
            target_schema='snapshots',
            check_cols= 'all'
        )
    }}

select
        *
from {{ ref('modle_in_sample_folder') }}

{% endsnapshot %}

The order of the snapshot folder and ref file is .../project_folder/snapshots/test_snapshot.sql and .../project_folder/intermediate/model_in_sample_folder.sql


Solution

  • The problem was the location of my Snapshot folder. Once I moved it out of my models project folder, and up to one level in the folder hierarchy, I was able to run it successfully.