-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fix bigquery copy materialization #910
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, please reach out through a comment on this PR. CLA has not been signed by users: @m-sche-sky |
5a47c49
to
247fb64
Compare
247fb64
to
3a24767
Compare
Added a changie entry and fixed an account from which the commits were created |
From my point of view, this PR is ready for review, please let me know if there's anything missing :) |
@mikealfare and @dataders: I just added backport labels for 1.5 and 1.6 per #820 (comment). What else do we need to do to create backport PRs for these? |
resolves #820
Problem
Since dbt 1.5, bigquery's
materialization='copy'
does not work due to changed structure ofmodel.refs
and the introduction of model versioning. It used to be an array of arrays in 1.4, since 1.5 it is an array of dictionaries.The
ref
macro currently accepts one mandatory positional argument (name), one optional positional argument (package), and one optional keyword argument (version).Model versioning docs: https://docs.getdbt.com/docs/collaborate/govern/model-versions
Ref macro arguments docs: https://docs.getdbt.com/reference/dbt-jinja-functions/ref#advanced-ref-usage
Solution
This PR adapts to the new structure of
model.refs
and allows for an optional version argument.A functional test has been added to test if a very simple copy/incremental materialization works. This test should catch similar issues in the future. The test fails if executed against the current code and passes when executed against the fixed code in this PR. The test is heavily inspired by
test_simple_copy.sql
test from this repository.A similar solution was discussed in #820 but the discussion got stale, hence this PR, but I am keen on receiving any feedback!
Checklist