-
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
DBT Compile fails on 0.20.0 when referencing a macro from another package within a test. #3580
Comments
@thisiscab Thanks for opening. I'm still unable to reproduce this—the project compiles, runs, and tests just fine. That said, I'm using dbt v0.20.0 installed via Homebrew with python 3.9.5 on a Mac, so it's possible that a python/system discrepancy is at fault here. The error message looks a lot like the one in #3564. Over the past few months, we've resolved a number of issues around missing macros and packages in the rendering context. Out of curiosity, how have you installed dbt? |
That is very odd! I wouldn't have expected this type of issue to be caused by Python / OS! It does really look like the issue you're pointing to. We have a Docker image: # (Debian 10.10)
FROM python:3.8-buster
[REDACTED]
RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends postgresq
RUN pip install --upgrade pip setuptools wheel dbt-snowflake==0.20.0
[REDACTED] And then within that Docker Image, we simply run the DBT command -- Nothing special! |
Hey @thisiscab, like @jtcohen6, I'm unable to recreate this as well |
@kwigley Hello! Here is the output that you've asked me. I've censored part of it! I can't help but realize that I'm now noticing this following error:
I may be misunderstanding the documentation but what I have; # dbt_project.yml of the custom_utils package
name: 'custom_utils'
version: '1.0.0'
config-version: 2
macro-paths: ["macros"]
require-dbt-version: [">=0.20.0", "<0.21.0"]
dispatch:
- macro_namespace: 'dbt_utils'
search_order: ['custom_utils', 'dbt_utils'] Seems valid per this documentation: https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#overriding-package-macros. Thanks! |
@thisiscab thanks a bunch, will take a look. As one last sanity check, are you able to confirm all the versions of the dbt packages installed in the docker container? something like: $ pip freeze | grep dbt
dbt-core==0.20.0
dbt-extractor==0.2.0
dbt-snowflake==0.20.0 |
:) |
Hey just wanted to jump in and say I'm facing the exact same issue: dbt is installed via pipenv
this is my schema test:
Mac OS 11.6 |
@ahmedrad Thanks for the report! I was able to reproduce the issue using the example you've provided:
The issue is that tests:
- not_null
- relationships:
to: source('auth', 'user') # test argument
field: userid # test argument
config: # test config, must be rendered at parse time, macros other than var + env_var are not supported today
where: "day < {{ dbt_utils.dateadd('day', -1, 'current_date') }}" We augmented the rendering context for test configs in v0.20.1 to add support for @gshank Could you weigh in on the difficulty and desirability of supporting arbitrary macros in the parse-time rendering context of configs, defined in yaml files (not I do think your example is different from the original issue report, since [Update: more thorough example and explanation in #4103] |
We could statically parse for macros like we do for the test node macros calls. We could try to create a reusable context that contains all of the macros. |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers. |
Describe the bug
When running
dbt compile
after migrating to DBT 0.20.0 from DBT 0.19.1 we're hit with a Compilation Error.Steps To Reproduce
We have two packages, one that "runs" the code and another one that acts as a "library" (in this example it's called
custom_utils
.In our custom_utils we have the following macro:
In our runner package, we have the following:
And finally, the dbt_projects of custom_utils:
Expected behavior
DBT should be able to compile the above and replace the template with
expression: "order_id not in ('error-shouldnt-happen')"
as it was previously doing in0.19.1
Screenshots and log output
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
The output of
python --version
:Additional context
Is there a potential workaround that we could apply before waiting for a potential "official" patch?
The text was updated successfully, but these errors were encountered: