From a583652f121de90b06d773b82cfb19f39bc929cd Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Tue, 24 Dec 2019 19:06:42 -0700 Subject: [PATCH] Parse model hooks for refs Add a parse pass for model hooks, parse them like models Attach the hook refs as if they were on the model Add a test exercising refs automatic commit by git-black, original commits: 22db36c4a6b2937803dd3e7271f006d08717cb0e --- core/dbt/parser/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/dbt/parser/base.py b/core/dbt/parser/base.py index 3eea7e12156..6068b0f391d 100644 --- a/core/dbt/parser/base.py +++ b/core/dbt/parser/base.py @@ -223,7 +223,7 @@ def _create_parsetime_node( ) raise ParsingException(msg, node=node) - def _context_for( + def _context_for(self, parsed_node: IntermediateNode, config: ContextConfig) -> Dict[str, Any]: self, parsed_node: IntermediateNode, config: ContextConfig ) -> Dict[str, Any]: return generate_parser_model_context( @@ -312,8 +312,7 @@ def update_parsed_node_config( # at this point, we've collected our hooks. Use the node context to # render each hook and collect refs/sources - hooks = list(itertools.chain(parsed_node.config.pre_hook, - parsed_node.config.post_hook)) + hooks = list(itertools.chain(parsed_node.config.pre_hook, parsed_node.config.post_hook)) # skip context rebuilding if there aren't any hooks if not hooks: return