Skip to content

Commit

Permalink
Parse model hooks for refs
Browse files Browse the repository at this point in the history
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:
  22db36c
  • Loading branch information
Jacob Beck authored and iknox-fa committed Feb 8, 2022
1 parent dbb8d1b commit a583652
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/dbt/parser/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a583652

Please sign in to comment.