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

Fix yaml snapshot specification with data tests #11156

Merged
merged 3 commits into from
Dec 18, 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/Fixes-20241216-134645.yaml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 8 additions & 1 deletion core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import pathlib
import time
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass, field
Expand Down Expand Up @@ -289,9 +290,15 @@
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(

Check warning on line 294 in core/dbt/parser/schemas.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/parser/schemas.py#L294

Added line #L294 was not covered by tests
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"],
Expand Down
8 changes: 8 additions & 0 deletions tests/functional/snapshots/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@
updated_at: updated_at
meta:
owner: 'a_owner'
columns:
- name: id
data_tests:
- not_null
"""

snapshots_pg__snapshot_mod_yml = """
Expand All @@ -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 = """
Expand Down
Loading