Skip to content

Commit

Permalink
Changie, update test
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Oct 1, 2024
1 parent 9d0cc3c commit 8ee3f63
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20241001-134051.yaml
Original file line number Diff line number Diff line change
@@ -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"
108 changes: 108 additions & 0 deletions schemas/dbt/manifest/v12.json
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -1739,6 +1745,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -2387,6 +2399,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -3172,6 +3190,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -3976,6 +4000,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -5331,6 +5361,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -5979,6 +6015,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -6498,6 +6540,12 @@
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
Expand Down Expand Up @@ -6931,6 +6979,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -10510,6 +10564,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -11543,6 +11603,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -12191,6 +12257,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -12976,6 +13048,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -13780,6 +13858,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -15135,6 +15219,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -15783,6 +15873,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down Expand Up @@ -16302,6 +16398,12 @@
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
Expand Down Expand Up @@ -16735,6 +16837,12 @@
"type": "string"
}
},
"unrendered_config_call_dict": {
"type": "object",
"propertyNames": {
"type": "string"
}
},
"relation_name": {
"anyOf": [
{
Expand Down
7 changes: 7 additions & 0 deletions tests/functional/snapshots/test_basic_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest
import pytz
from dbt.artifacts.resources.types import NodeType

from dbt.tests.util import (
check_relations_equal,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8ee3f63

Please sign in to comment.