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

Prefer internal macros when called explicitly #5907

Merged
merged 4 commits into from
Sep 27, 2022

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Sep 22, 2022

resolves #5720

Description

  • If an internal macro is called as {{ dbt.internal_macro() }}, prefer the version actually defined in the internal (dbt) namespace. All of these macros should be dispatched, and still overrideable by end users, using more explicit nomenclature + config patterns.
  • If an internal macro is called as {{ internal_macro() }} (no namespace), it will follow global macro resolution order, and a root project reimplementation of internal_macro will take precedence

I haven't been able to come up with a concrete example of a behavior (however gnarly or undocumented) that worked before this change, and would be broken after. Let's run some functional tests and find out what breaks!

If things seem to be working, I can pull the reproduction case from #5720 (comment) into a new functional test.

Checklist

@cla-bot cla-bot bot added the cla:yes label Sep 22, 2022
@github-actions
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@jtcohen6 jtcohen6 force-pushed the jerco/macro-resolution-explicit-internal-namespace branch from 07a015a to 35a7661 Compare September 23, 2022 12:32
@jtcohen6 jtcohen6 marked this pull request as ready for review September 23, 2022 12:33
@jtcohen6 jtcohen6 requested review from a team as code owners September 23, 2022 12:33
Copy link
Member

@emmyoop emmyoop left a comment

Choose a reason for hiding this comment

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

The actual change looks fine. However, this isn't the correct test file format. I have the appetite to fix up the file formatting and will push the changes up to your branch.

@jtcohen6
Copy link
Contributor Author

However, this isn't the correct test file format.

guilty!

I have the appetite to fix up the file formatting and will push the changes up to your branch.

thank you so so so much @emmyoop 🙏

@emmyoop
Copy link
Member

emmyoop commented Sep 23, 2022

Close and reopen to re-kick off snyk and make sure my changes didn't cause anything bad!

@emmyoop emmyoop closed this Sep 23, 2022
@emmyoop emmyoop reopened this Sep 23, 2022
@leahwicz leahwicz merged commit 834ac71 into main Sep 27, 2022
@leahwicz leahwicz deleted the jerco/macro-resolution-explicit-internal-namespace branch September 27, 2022 12:50
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.

[CT-1090] [Bug] dbt.type_timestamp() is not working using dbt 1.2.1
3 participants