-
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
[Feature] Support ref + custom macros in test config rendering context #4103
Comments
@glenn-wawo Unfortunately, I think you will need to use a custom generic to achieve this behavior. The issue is that test configs:
With the flexibility of supporting {% test not_null_custom_where(model, column_name, custom_where) %}
select *
from {{ model }}
where {{ column_name }} is null
and {{ custom_where }}
{% endtest %} name: column_name
description: description
tests:
- not_null_custom_where:
# not a config, an argument!
custom_where: "field < (SELECT max(field) FROM {{ ref('model') }} )" This is the same issue reported in #3580 (comment), and I do take the reduction in functionality seriously. There are a few ways we could think about supporting this:
|
thanks @jtcohen6. I actually did the same workaround solution that you suggested :) Good to know where you guys stand on this issue currently. I'll be watching the space in dbt's future update |
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. |
Is there an existing issue for this?
Current Behavior
I have a test within a model that has the following syntax:
When you run the test, the model reference within the subquery in the config is not translated into an actual table and the compiled SQL subquery in the test config looks like:
Expected Behavior
expecting dbt to recognise the model reference in the test config & the subquery to be compiled into
Steps To Reproduce
Relevant log output
Environment
What database are you using dbt with?
snowflake
Additional Context
This test setup worked when we use
dbt_utils.not_null_where
functionality before it was deprecated with dbt 0.20The text was updated successfully, but these errors were encountered: