The problem I’m having
I want to make a second model version of a snapshot table. And the versioned snapshot is not recognized.
The context of why I’m trying to do this
It’s for a spike/PoC for now, but the snapshot table is our final table that is consumed by customers, therefore we think its sensible to be able to version that model properly. The ‘model version’ feature in dbt does not seem to work, it just recognizes the new _v1 and _v2 models as separate models and my_snap
does not automatically refer to the “latest_version”, as it does for versioned dbt tables.
What I’ve already tried
Renaming the snapshot my_snap
to my_snap_v1
and creating a my_snap_v2
. Then adding version info in a YAML file. But when running dbt run -t a --defer --state state -s my_snap
, it cant find the node but does show a warning: 08:01:44 [WARNING]: Did not find matching node for patch with name 'my_snap' in the 'snapshots' section of file 'src/snapshots\snapshot_schema.yml'
.
When doing this for a table, it works fine.
Some example code or error messages
Our snapshots are defined in one file:
{% snapshot my_snap_v1 %}
select 1 as a
{% endsnapshot %}
{% snapshot my_snap_v2 %}
select 2 as a
{% endsnapshot %}
- name: my_snap
latest_version: 1
versions:
- v: 1
alias: my_snap
- v: 2
description: "some important table."
columns:
- name: a