Skip to content

Second run of dbt snapshot missing valid from/to columns #639

@Malakai13

Description

@Malakai13

I have a snapshot that looks like this:

{% snapshot my_snapshot %}

{{
    config(
        target_schema='my_schema',
        unique_key='TaskId',
        strategy='timestamp',
        updated_at='LastModified',
        snapshot_meta_column_names={
            "dbt_valid_from": "EffectiveStartDate",
            "dbt_valid_to": "EffectiveEndDate"
        }
    )
}}

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

{% endsnapshot %}

It creates the table correctly the first time, with the EffectiveStartDate/EffectiveEndDate columns. But the second time I run this, I get this error.

Snapshot target is missing configured columns (missing "dbt_valid_from", "dbt_valid_to"). See https://docs.getdbt.com/docs/build/snapshots#snapshot-meta-fields for more information.

It looks like some column check is still looking for the original dbt_valid_from/dbt_valid_to columns rather than the override.

My requirements.txt:

dbt-core==1.9.*
dbt-sqlserver==1.9.*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions