Skip to content

Commit

Permalink
Add New Config Properties and Schema for Snapshot Hard Deletes (#10972)…
Browse files Browse the repository at this point in the history
… (#11037)

* Add changelog entry.

* Update schemas and test fixtures for new snapshot meta-column

* Add back comment.

Co-authored-by: Gerda Shank <[email protected]>
  • Loading branch information
peterallenwebb and gshank authored Nov 25, 2024
1 parent d305137 commit 5587249
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20241104-120053.yaml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions core/dbt/artifacts/resources/v1/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
22 changes: 22 additions & 0 deletions schemas/dbt/manifest/v12.json
Original file line number Diff line number Diff line change
Expand Up @@ -6754,6 +6754,17 @@
}
],
"default": null
},
"dbt_is_deleted": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
}
},
"additionalProperties": false
Expand Down Expand Up @@ -16672,6 +16683,17 @@
}
],
"default": null
},
"dbt_is_deleted": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
}
},
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions tests/functional/artifacts/expected_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
1 change: 1 addition & 0 deletions tests/functional/list/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5587249

Please sign in to comment.