How can I change the default columns name in a snapshot: dbt_valid_from dbt_valid_to?
I override the macro default__build_snapshot_table and it is working the first time, but when I re run the snapshot I am getting the following error:
How can I change the default columns name in a snapshot: dbt_valid_from dbt_valid_to?
I override the macro default__build_snapshot_table and it is working the first time, but when I re run the snapshot I am getting the following error:
Manish Jindal
On
As mentioned by Adam above, there are more macros that you need to override. You should be looking at snapshot_merge_sql and snapshot_staging_table and also a assert
{{ adapter.valid_snapshot_target(target_relation) }}
In this link which you may have to override or remove at all.
Copyright © 2021 Jogjafile Inc.

There are 2 macros you need to override. The first (
build_snapshot_table) handles the initial creation of the snapshot table, which you've done. The second (build_snapshot_staging_table) handles the delta on subsequent runs. You can see this in the dbt-core/snapshot.sql code (snapshot.sql):Take a look at the default implementation to see what logic you need to replace for renaming the columns. Should be pretty straightforward.