diff --git a/.changes/unreleased/Features-20241104-120053.yaml b/.changes/unreleased/Features-20241104-120053.yaml new file mode 100644 index 00000000000..9451fa49884 --- /dev/null +++ b/.changes/unreleased/Features-20241104-120053.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Add new hard_deletes="new_record" mode for snapshots. +time: 2024-11-04T12:00:53.95191-05:00 +custom: + Author: peterallenwebb + Issue: "10235" diff --git a/core/dbt/artifacts/resources/v1/snapshot.py b/core/dbt/artifacts/resources/v1/snapshot.py index 1a7b9344ca0..976c93a4d60 100644 --- a/core/dbt/artifacts/resources/v1/snapshot.py +++ b/core/dbt/artifacts/resources/v1/snapshot.py @@ -13,6 +13,7 @@ class SnapshotMetaColumnNames(dbtClassMixin): dbt_valid_from: Optional[str] = None dbt_scd_id: Optional[str] = None dbt_updated_at: Optional[str] = None + dbt_is_deleted: Optional[str] = None @dataclass @@ -37,6 +38,7 @@ def snapshot_table_column_names(self): "dbt_valid_to": self.snapshot_meta_column_names.dbt_valid_to or "dbt_valid_to", "dbt_scd_id": self.snapshot_meta_column_names.dbt_scd_id or "dbt_scd_id", "dbt_updated_at": self.snapshot_meta_column_names.dbt_updated_at or "dbt_updated_at", + "dbt_is_deleted": self.snapshot_meta_column_names.dbt_is_deleted or "dbt_is_deleted", } def final_validate(self): diff --git a/schemas/dbt/manifest/v12.json b/schemas/dbt/manifest/v12.json index 8a43f2e978b..892c0014e41 100644 --- a/schemas/dbt/manifest/v12.json +++ b/schemas/dbt/manifest/v12.json @@ -6754,6 +6754,17 @@ } ], "default": null + }, + "dbt_is_deleted": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false @@ -16672,6 +16683,17 @@ } ], "default": null + }, + "dbt_is_deleted": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false diff --git a/tests/functional/artifacts/expected_manifest.py b/tests/functional/artifacts/expected_manifest.py index aafe093d86e..c7deb2e8ea8 100644 --- a/tests/functional/artifacts/expected_manifest.py +++ b/tests/functional/artifacts/expected_manifest.py @@ -112,6 +112,7 @@ def get_rendered_snapshot_config(**updates): "dbt_valid_from": None, "dbt_updated_at": None, "dbt_scd_id": None, + "dbt_is_deleted": None, }, "dbt_valid_to_current": None, "tags": [], diff --git a/tests/functional/list/test_list.py b/tests/functional/list/test_list.py index 5442436271e..4a08cfad478 100644 --- a/tests/functional/list/test_list.py +++ b/tests/functional/list/test_list.py @@ -69,6 +69,7 @@ def expect_snapshot_output(self, happy_path_project): # noqa: F811 "dbt_updated_at": None, "dbt_valid_from": None, "dbt_valid_to": None, + "dbt_is_deleted": None, }, "unique_key": "id", "strategy": "timestamp",