diff --git a/website/docs/reference/snapshot-properties.md b/website/docs/reference/snapshot-properties.md index 49769af8f6d..ac87f6c7f97 100644 --- a/website/docs/reference/snapshot-properties.md +++ b/website/docs/reference/snapshot-properties.md @@ -41,3 +41,37 @@ snapshots: ``` + + +## Define snapshots in YAML + +Defining a snapshot in YAML treats snapshots as a distinct resource type, separate from models, allowing for improved organization and consistency within your code. + +They don't contain logic, similar to exposures, sources, and tests. To add extra logic to your snapshot, you can break it out into an ephemeral model for cleaner development and testing, and then create a snapshot of that model. + + + +```yml + +# snapshots/my_snapshots.yml +snapshots: + - name: orders_snapshot + relation: source('jaffle_shop', 'orders') + config: + schema: snapshots + database: analytics + unique_key: id + strategy: timestamp + updated_at: updated_at + +``` + + +In this example, the snapshot configuration tracks changes to the orders table over time. The transformation in this snapshot is: `select * from {{ source('jaffle_shop', 'orders') }}`. + + +In [dbt Cloud Versionless](/docs/dbt-versions/upgrade-dbt-version-in-cloud#versionless), you can use the new way to define snapshots in your project. This feature will also be available in the upcoming 1.9 release. + + + +