dbt-labs / docs.getdbt.com

The code behind docs.getdbt.com
https://docs.getdbt.com/
Apache License 2.0
118 stars 928 forks source link

[Core] Snapshot config can be set in schema / properties YAML file #5627

Closed FishtownBuildBot closed 5 hours ago

FishtownBuildBot commented 3 months ago

At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated.

Issue: https://github.com/dbt-labs/dbt-core/issues/4000 Pull request: https://github.com/dbt-labs/dbt-core/pull/10275

On page https://docs.getdbt.com/reference/snapshot-configs, there is the line "The following resource-specific configurations are only available to Snapshots:" followed by a line with three tabs: "Project file Property file. Config block". If you click "Property file" it says: "Note: Required snapshot properties will not work when defined in config YAML blocks. We recommend that you define these in dbt_project.yml or a config() block within the snapshot .sql file." This is no longer true.

There should be a block displaying the config:

snapshots:
  - name: my_snapshot
    config:
      schema: specific_schema
      unique_key: specific_id
      strategy: timestamp
      updated_at: updated_at

Note: the use of schema instead of "target_schema" is a new thing in versionless and 1.9. I'm not sure how you handle that.

Example

In Versionless and v1.9 it is possible to specify a snapshot in a SQL file and add configurations in a YAML file like below:

snapshots/orders_snapshot_file.sql

{% snapshot orders_snapshot %}
select * from {{ ref('orders') }}
{% endsnapshot %}

snapshots/_snapshots.yml or models/schema.yml or ...

snapshots:
  - name: orders_snapshot
    config:
      target_schema: test
      strategy: check
      unique_key: id
      check_cols: ['status']
nghi-ly commented 2 weeks ago

@nataliefiann : this might not need a docs update. please check with gerda to double-check.

nataliefiann commented 2 weeks ago

Hiya @gshank

Happy Monday - I hope you're well.

I just wanted to ask if this still needs a docs update?

Kind Regards Natalie

graciegoheen commented 1 week ago

Yes this will need a docs update!