Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New Config Properties and Schema for Snapshot Hard Deletes #10972

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading