From 8ee3f63a15208d9ef743c5150e580dd78e5604c9 Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Tue, 1 Oct 2024 13:42:39 -0400 Subject: [PATCH] Changie, update test --- .../unreleased/Features-20241001-134051.yaml | 6 + schemas/dbt/manifest/v12.json | 108 ++++++++++++++++++ .../snapshots/test_basic_snapshot.py | 7 ++ 3 files changed, 121 insertions(+) create mode 100644 .changes/unreleased/Features-20241001-134051.yaml diff --git a/.changes/unreleased/Features-20241001-134051.yaml b/.changes/unreleased/Features-20241001-134051.yaml new file mode 100644 index 00000000000..60ada51ece3 --- /dev/null +++ b/.changes/unreleased/Features-20241001-134051.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Enable use of multi-column unique key in snapshots +time: 2024-10-01T13:40:51.297529-04:00 +custom: + Author: gshank + Issue: "9992" diff --git a/schemas/dbt/manifest/v12.json b/schemas/dbt/manifest/v12.json index d1246d526ce..285da79ae98 100644 --- a/schemas/dbt/manifest/v12.json +++ b/schemas/dbt/manifest/v12.json @@ -706,6 +706,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -1739,6 +1745,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -2387,6 +2399,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -3172,6 +3190,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -3976,6 +4000,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -5331,6 +5361,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -5979,6 +6015,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -6498,6 +6540,12 @@ { "type": "string" }, + { + "type": "array", + "items": { + "type": "string" + } + }, { "type": "null" } @@ -6931,6 +6979,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -10510,6 +10564,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -11543,6 +11603,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -12191,6 +12257,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -12976,6 +13048,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -13780,6 +13858,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -15135,6 +15219,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -15783,6 +15873,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { @@ -16302,6 +16398,12 @@ { "type": "string" }, + { + "type": "array", + "items": { + "type": "string" + } + }, { "type": "null" } @@ -16735,6 +16837,12 @@ "type": "string" } }, + "unrendered_config_call_dict": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "relation_name": { "anyOf": [ { diff --git a/tests/functional/snapshots/test_basic_snapshot.py b/tests/functional/snapshots/test_basic_snapshot.py index b5a508b04a9..7e2e6429ed7 100644 --- a/tests/functional/snapshots/test_basic_snapshot.py +++ b/tests/functional/snapshots/test_basic_snapshot.py @@ -3,6 +3,7 @@ import pytest import pytz +from dbt.artifacts.resources.types import NodeType from dbt.tests.util import ( check_relations_equal, @@ -73,6 +74,12 @@ def snapshot_setup(project, num_snapshot_models=1): path = os.path.join(project.test_data_dir, "seed_pg.sql") project.run_sql_file(path) + manifest = run_dbt(["parse"]) + for node in manifest.nodes.values(): + if node.resource_type != NodeType.Snapshot: + continue + print(f"--- {node.unique_id} => {node.config.unique_key}, {type(node.config.unique_key).__name__}") + results = run_dbt(["snapshot"]) assert len(results) == num_snapshot_models