Describe the feature
A more general solution for #10236 and #10864 and dbt-labs/dbt-snowflake#1198
Folks want to be able to test just their "new" data before it's inserted into their existing table. This is relevant for:
- snapshots
- incremental models
For example, you may want to test that your unique_key is actually unique for the "new" data. If that test fails don't insert the "new" data into the existing table.
We should create a new data test configuration to allow you to configure a given data to only run on the "new" data.
models:
- name: my_model
columns:
- name: id
data_tests:
- unique:
new_records_only: true # name/spec TBD
Acceptance criteria:
- you can set this config on a data test for an incremental model
- you can set this config on a data test for a snapshot
- when set, the data test will only run on "new" data before insert/merge
- if data test fails, the subsequent insert/merge will be skipped