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

[Bug] <macro is not honoring the defer flag> #11019

Open
2 tasks done
emilee-jurkowski opened this issue Nov 20, 2024 · 0 comments
Open
2 tasks done

[Bug] <macro is not honoring the defer flag> #11019

emilee-jurkowski opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working triage

Comments

@emilee-jurkowski
Copy link

emilee-jurkowski commented Nov 20, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

In my model_b.sql I have something like {% set val_list = dbt_utils.get_column_values(table=ref('model_a'), column='VAL') %}. I try to run a dbt build using a defer flag. model_a does not exist in the the db & schema that I am building in, yet it still will not use the db & schema I am telling it to defer to. When I run dbt ls -s 1+model_b, dbt does recognize that model_a is upstream and being referred to.

Expected Behavior

In the above example, the dbt_utils macro should use the defer db & schema to get the column values from model_a.

Steps To Reproduce

I have model_b like such

{% set val_list = dbt_utils.get_column_values(table=ref('model_a'), column='VAL') %}

{% for val in val_list %}
select
      col_1
    , null as col_2
    , date_trunc('month', col_3) as col_3  
    , '{{ val }}' as val
from {{ ref('model_ab') }}
{%- endfor -%}

Then run dbt run -s model_b+1 in the dev environment with a defer to the prod environment.

Relevant log output

Compilation Error in model model_b (models/model_b.sql)
    In get_column_values(): relation DEV.SCHEMA.MODEL_A does not exist and no default value was provided.

Environment

- dbt: 1.8.7

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@emilee-jurkowski emilee-jurkowski added bug Something isn't working triage labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant