Skip to content

Commit

Permalink
Fix parsing error for projects using the new YAML format for snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
amardatar committed Mar 5, 2025
1 parent 77d8e32 commit 6ea0507
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20250305-110257.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fixes parsing errors when using the new YAML format for snapshots
time: 2025-03-05T11:02:57.829685Z
custom:
Author: amardatar
Issue: "11164"
5 changes: 5 additions & 0 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ def _add_yaml_snapshot_nodes_to_manifest(
block.path.relative_path, snapshot["name"] + ".sql"
)
)

# This is used to initially populate `raw_code`, which must not be empty to pass validation.
if block.file.contents is None:
block.file.contents = ""

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

View check run for this annotation

Codecov / codecov/patch

core/dbt/parser/schemas.py#L307

Added line #L307 was not covered by tests

snapshot_node = parser._create_parsetime_node(
block,
compiled_path,
Expand Down

0 comments on commit 6ea0507

Please sign in to comment.