dbt snapshots throws compilation error

Compilation error

I am trying to run my snapshots to track historic changes

It throws error like
"Compilation Error
unexpected EOF, expected string, got “model_name’) }}
{% endsnapshot %}”

my snapshot code

{% snapshot db_staff_snapshots %}
  {{
       config(
        target_schema='snapshots',
        strategy='check',
        unique_key='staff_id',
        check_cols=['email','name','username',position','position_level','citizenship','residence','offboarded_at'],
       )
  }}

  SELECT * FROM {{ ref('stg_db_staff') }} 

{% endsnapshot %}

Hey @sowndarya666, you’re missing a leading single quote around your position field. The code should be:

{% snapshot db_staff_snapshots %}
  {{
       config(
        target_schema='snapshots',
        strategy='check',
        unique_key='staff_id',
        check_cols=['email','name','username','position','position_level','citizenship','residence','offboarded_at'],
       )
  }}

  SELECT * FROM {{ ref('stg_db_staff') }} 

{% endsnapshot %}

Thank you!!

Note: @ originally posted this reply in Slack. It might not have transferred perfectly.

1 Like