From 8fe649f373ba962fda2bcfaf06a6283cefcc05bb Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Fri, 13 Dec 2024 14:47:18 -0500 Subject: [PATCH 1/3] Add test to yaml snapshot definition --- tests/functional/snapshots/fixtures.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/functional/snapshots/fixtures.py b/tests/functional/snapshots/fixtures.py index 562fcb4b10f..df0c29b8fa5 100644 --- a/tests/functional/snapshots/fixtures.py +++ b/tests/functional/snapshots/fixtures.py @@ -301,6 +301,10 @@ updated_at: updated_at meta: owner: 'a_owner' + columns: + - name: id + data_tests: + - not_null """ snapshots_pg__snapshot_mod_yml = """ @@ -313,6 +317,10 @@ updated_at: updated_at meta: owner: 'b_owner' + columns: + - name: id + data_tests: + - not_null """ snapshots_pg__snapshot_no_target_schema_sql = """ From 59ddd2f627bdb69ca3c1fff2edc392eed422c25f Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Mon, 16 Dec 2024 13:45:02 -0500 Subject: [PATCH 2/3] Set compiled path using snapshot name + ".sql" --- core/dbt/parser/schemas.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/dbt/parser/schemas.py b/core/dbt/parser/schemas.py index 12bb84a5037..e9c66e184e4 100644 --- a/core/dbt/parser/schemas.py +++ b/core/dbt/parser/schemas.py @@ -1,4 +1,5 @@ import datetime +import pathlib import time from abc import ABCMeta, abstractmethod from dataclasses import dataclass, field @@ -289,9 +290,15 @@ def _add_yaml_snapshot_nodes_to_manifest( parser = SnapshotParser(self.project, self.manifest, self.root_project) fqn = parser.get_fqn_prefix(block.path.relative_path) fqn.append(snapshot["name"]) + + compiled_path = str( + pathlib.PurePath("").joinpath( + block.path.relative_path, snapshot["name"] + ".sql" + ) + ) snapshot_node = parser._create_parsetime_node( block, - self.get_compiled_path(block), + compiled_path, parser.initial_config(fqn), fqn, snapshot["name"], From 2b1e4c17c7ea2ef506d2cd6f07a22ff91bd2d32a Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Mon, 16 Dec 2024 13:46:52 -0500 Subject: [PATCH 3/3] Changie --- .changes/unreleased/Fixes-20241216-134645.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20241216-134645.yaml diff --git a/.changes/unreleased/Fixes-20241216-134645.yaml b/.changes/unreleased/Fixes-20241216-134645.yaml new file mode 100644 index 00000000000..2ef41dc0d2d --- /dev/null +++ b/.changes/unreleased/Fixes-20241216-134645.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Error writing generic test at run time +time: 2024-12-16T13:46:45.936573-05:00 +custom: + Author: gshank + Issue: "11110"