Skip to content

Commit

Permalink
Issue message instead of exception when patch does not have a matching
Browse files Browse the repository at this point in the history
node
  • Loading branch information
gshank committed Nov 8, 2021
1 parent 8442fb6 commit 793131d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from dbt.adapters.factory import get_adapter, get_adapter_package_names
from dbt.clients.jinja import get_rendered, add_rendered_test_kwargs
from dbt.clients.yaml_helper import load_yaml_text
from dbt.logger import GLOBAL_LOGGER as logger
from dbt.parser.schema_renderer import SchemaYamlRenderer
from dbt.context.context_config import (
ContextConfig,
Expand Down Expand Up @@ -886,11 +887,13 @@ def parse_patch(
# re-application of the patch in partial parsing.
node.patch_path = source_file.file_id
else:
raise ParsingException(
msg = (
f"Did not find matching node for patch with name '{patch.name}' "
f"in the '{patch.yaml_key}' section of "
f"file '{source_file.path.original_file_path}'"
)
logger.info(msg)
return

# patches can't be overwritten
node = self.manifest.nodes.get(unique_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_postgres_pp_models(self):
# referred to in schema file
self.copy_file('test-files/models-schema2.yml', 'models/schema.yml')
self.rm_file('models/model_three.sql')
with self.assertRaises(ParsingException):
with self.assertRaises(CompilationException):
results = self.run_dbt(["--partial-parse", "--warn-error", "run"])

# Put model back again
Expand Down Expand Up @@ -312,7 +312,7 @@ def test_postgres_pp_sources(self):

# Change seed name to wrong name
self.copy_file('test-files/schema-sources5.yml', 'models/sources.yml')
with self.assertRaises(ParsingException):
with self.assertRaises(CompilationException):
results = self.run_dbt(["--partial-parse", "--warn-error", "run"])

# Put back seed name to right name
Expand Down

0 comments on commit 793131d

Please sign in to comment.