-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-1984] [Regression] In v1.4, seeds with hooks calling macros raise an AttributeError #6806
Comments
Think I narrowed it down.. There are seeds in my project that have a post-hook that calls a macro. e.g.
Works ok on previous? Need to try a simpler macro.. I tried changing the post-hook to some generic sql, i.e. "select 1 as test" and the project compiled. edit: does not work with a |
Thanks for opening @rudeb0y ! Agreed that you narrowed it down, and I was able to reproduce the same error using dbt-core==1.4.1 and dbt-snowflake==1.40 Here's what I did to reproduce:
name: "my_dbt_project"
version: "1.0.0"
config-version: 2
profile: "my_profile"
seeds:
+post-hook:
- "{{ my_silly_macro() }}"
{% macro my_silly_macro() %}
select 1 as test
{% endmacro %} Then run: dbt seed -s dummy_seed Then I got the same error as you:
|
Does this remove the dbt-core/core/dbt/contracts/util.py Line 253 in 52be5ff
|
In v1.4, we removed dependency-related attributes from seeds, since they can't actually use However, it's true that seeds can have pre- and post-hooks. Those hooks can call macros! It's important we track those dependencies for dbt-core/core/dbt/clients/jinja.py Lines 308 to 324 in b2ea2b8
Can those macros also call At first glance, yes. In practice, I sure hope not. If I try this in {% macro my_silly_macro() %}
select * from {{ ref('my_model') }}
{% endmacro %} I run
In ...
"seed.test.seed": {
"resource_type": "seed",
"depends_on": {
"macros": [
"macro.test.my_silly_macro"
],
"nodes": [
"model.test.my_model"
]
},
... I hate this. I'm willing to call it an unsupported & undocumented anti-pattern. Proposed resolution
I can open a PR for this, with the (bad) code I wrote while trying to understand the codepaths in play—but I definitely want to get @gshank's blessing before moving forward with this approach. |
Is this a regression in a recent version of dbt-core?
Current Behavior
After trying to upgrade both dbt-utils, dbt-core and dbt-snowflake to 1.0.0, 1.4.1 and 1.4.0 respectively, my project no-longer compiles.
Downgrading just the dbt parts (core and snowflake) and it compiles.
Expected/Previous Behavior
I expect that after following migration guides etc. that the project will compile.
It compiles as normal if I downgrade dbt to previous version (1.3.2)
Steps To Reproduce
This is not easily reproducible. It did not affect a new project, just a current one. Something in 1.4.1 is different in the fact that downgrading dbt, the project does compile.
Relevant log output
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
This must be something weird with my project. Out of interest I created a new project in the same virtual env and that worked.
I will start trying to copy over things to see what is causing the breakage, starting with seeds as the error mentioned
SeedNode
The text was updated successfully, but these errors were encountered: