-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow ref override #2028
Allow ref override #2028
Conversation
Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA. In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, don't hesitate to ping @drewbanin. CLA has not been signed by users: @alanmcruickshank |
@drewbanin - I've now signed the CLA. |
Thanks for making this PR @alanmcruickshank! I think this looks really good - I'll do some functional testing now. Adding @beckjake to review since he's spent a lot of time around this part of the codebase recently. This probably won't make it out for 0.15.1 - can you change the base branch to |
The cla-bot has been summoned, and re-checked this pull request! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I have a few suggestions on minor code style tweaks, but I love the idea and the general concept of the implementation. Let me know if I missed any obvious reasons for doing things this way!
Also, can you please add an integration test exercising this feature (postgres is fine as this is very generic code, feel free to do repeated pushes to trigger the azure postgres tests). I've been doing some contexts work elsewhere and I would hate to cause a regression. I'd be happy to help you with writing one if you need assistance, I know the test suite can be pretty arcane.
d911a21
to
43f099b
Compare
Thanks @drewbanin @beckjake .
|
@alanmcruickshank My method for writing a new integration test is usually this:
The test should have
For the test itself, there are broadly two techniques:
|
3f763e3
to
a643d5c
Compare
I should have mentioned: I haven't set it up fresh in quite a while, but if you don't want to push to trigger tests, and you have docker/docker-compose set up, you should be able to run your test locally with something like this:
The first time will probably take a while as it has to pull some big silly containers (postgres + our test one) and build the tox environment. |
test/integration/055_ref_override_test/macros/ref_override_macro.sql
Outdated
Show resolved
Hide resolved
83c8ad9
to
37e373a
Compare
@beckjake - integration test is in and working - thanks for the pointers! Yes it did take a while to download but still faster than the azure tests 😄 . I've squashed all my commits for tidiness. Ready for review I think. |
just kicked off the tests here @alanmcruickshank :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Let's just see how the tests go (thanks for kicking them off @drewbanin)
Really nice work @alanmcruickshank! I think we'll want to update the docs here: https://docs.getdbt.com/docs/jinja-context We can add a section for I usually handle the docs updates when a new release is ready, but let me know if there are specific things you'd like to touch on and I can be sure to include them. Merging this! Thanks again for this really lovely PR :) |
This is a very late re-entry, but the bug has hit me again and I thought I should get round to resubmitting a fox for #1603 .
These edits allow users to override built in functions like
ref
.For our use case (where we want to stop rendering the
database
portion of the object reference), the user just needs to have a macro such as:ref_override.sql
:And the ref function will be overridden, now not rendering the
database
.@drewbanin - I think this is much closer to what you originally envisioned. Have I overridden the parts that you had originally intended? If this is in line, I'd like to add the example macro above somewhere in the documentation for other users to find. Where would the best place be?