dbt-bigquery: [ADAP-695] [Regression] Error when use REF inside COPY materialization
Is this a regression in a recent version of dbt-bigquery?
- I believe this is a regression in dbt-bigquery functionality
- I have searched the existing issues, and I could not find an existing issue for this regression
Current Behavior
if you use REF in model with copy materialization, then you receive following error:
Compilation Error in model bla-bla
Model 'bla-bla' (models/model_copy.sql) depends on a node named 'name' which was not found
> in macro materialization_copy_bigquery (macros/materializations/copy.sql)
> called by model model_copy (models/model_copy.sql)
I’ve checked all previous versions and there is no issue at all. the issue is on 1.5 only if you use SOURCE then all works fine only REF usage leads above issue
Expected/Previous Behavior
both REF and SOURCE works fine within COPY materialization
Steps To Reproduce
use copy materialization with any of your source or model. config exampe:
{{ config(
materialized='copy'
)}}
select * from {{ source('ANY_YOUR_SOURCE') }}, {{ ref('ANY_YOUR_MODEL') }}
if you run this model on 1.5.x then you receive an error then delete REF (or change it to any other SOURCE) from this model and run. All works fine
Relevant log output
No response
Environment
- OS: dockerized env using `python:3.11-slim` image
- Python: 3.11
- dbt-core (working version): 1.4.6
- dbt-bigquery (working version): 1.4.3
- dbt-core (regression version): 1.5.2 (all 1.5.x)
- dbt-bigquery (regression version): 1.5.3 (all 1.5.x)
Additional Context
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 21 (19 by maintainers)
here’s the current plan for engineering
copymaterialization for1.8and onwardsHowever, we will not be able to address this work until October 23 at the earliest, given that the release cut of 1.7.0 is this week, and our annual user conference, Coalesce, is next week.
Model versioning is a new feature in 1.5 (as per https://docs.getdbt.com/docs/collaborate/govern/model-versions) so the keyword argument is new as well.
Similarly to @dbeatty10 I’m currently using
as a hot fix. I have not confirmed though that it really works with packages and versions.
A hint to @xemuliam about why lines 12 and 16 are similar, yet one does not work, is that while
model.sourcesis an array of arrays in 1.5,model.refsis an array of dictionaries (with keysnameand optionallypackageandversion). I’m not sure how it was in older versions than 1.5 but I suspectmodel.refsstructure was different.@xemuliam I can take a look at this 👀
@mikealfare and @dataders I didn’t notice pre-existing issues, so opened these up:
Hi @aranke ,
BigQuery copy materialization is the implementation of following API: https://cloud.google.com/bigquery/docs/managing-tables#copying_multiple_source_tables
The main advantages of it (please pay an attention that there can be more than one source table):
Hope it was clear enough
Env 1.5 spin up and run copy model:
==============================
Install dbt-bigquery 1.4 and run copy model inside the same container:
as you can see, the same model works fine in 1.4 but raises an error in 1.5