[dbt-core issue #10301] snapshots now can optionally respect generate schema/database/alias macros #5805
Closed
1 task done
Labels
content
Improvements or additions to content
improvement
Use this when an area of the docs needs improvement as it's currently unclear
Contributions
Link to the page on docs.getdbt.com requiring updates
We need to update our snapshot documentation. Here's some initial pages I've identified as needing updates:
I think we likely want to remove
target_schema
andtarget_database
configs from all of our snapshot examples - perhaps replace those withschema
anddatabase
.I think our best practice is still building your snapshots in a separate
schema
to avoid accidentally dropping them. They are not like models where if you drop them you can just rebuild them; dropping snapshots leads to losing all of your historical data.What part(s) of the page would you like to see updated?
Historically, snapshots require you set set an explicit
target_schema
(you can also set an explicittarget_database
) - meaning by default, regardless of what environment you're in (dev, ci, prod, etc.), when you rundbt snapshot
it will build to the same table.This can be problematic when trying to test out changes to existing snapshot or develop a new snapshot. Now that we have deferral and
dbt clone
, it no longer makes sense that snapshots wouldn't respectgenerate_schema_name
/generate_database_name
/generate_alias_name
like other resources (models, seeds, etc.).Changes:
target_schema
is now optional for snapshotstarget_schema
, your snapshot will respectgenerate_schema_name
macrotarget_database
, your snapshot will respectgenerate_schema_name
macrotarget_schema
and/ortarget_database
and that will be where your snapshot is built, but these are "old" configssnapshots
: you can now setdatabase
,schema
,alias
for your snapshots to be used by thegenerate_x_name
macrosAdditional information
From dbt-core issue dbt-labs/dbt-core#10301
The text was updated successfully, but these errors were encountered: