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

Feature: node depends_on.macros (#2082) #2103

Merged
merged 1 commit into from Feb 10, 2020

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented Feb 7, 2020

Fixes #2082

Add directly called macros into nodes' depends_on listing. Keep track of the call stack in thread-local storage for each model invocation in dbt compile, and record all the 0-depth nodes in depends_on.macros.

There is some legacy code that purports to capture macros (the ParserMacroCapture stuff). I messed with it a bit and as far as I can tell the relevant code (__call__) is never even called, so I went with this route because I'm confident it actually works...

@cla-bot cla-bot bot added the cla:yes label Feb 7, 2020
@beckjake beckjake changed the base branch from feature/contexts-redux to dev/barbara-gittings February 7, 2020 19:10
Clean up macro generation a bit
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent - I love the way you implemented the capturing of immediate macro calls here. I feared that this would be really gross/complicated, but it's so simple and pretty :)

I'll implement the corresponding docs functionality in dbt-labs/dbt-docs#61

Ship this!

@beckjake beckjake merged commit 1e6790a into dev/barbara-gittings Feb 10, 2020
@beckjake beckjake deleted the feature/macro-depends-on branch February 10, 2020 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add macros to depends_on list for nodes that can call macros
2 participants