-
Notifications
You must be signed in to change notification settings - Fork 179
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
Snowflake model configs for tests, too #23
Comments
|
You're right, this would require a mix of
For the first question: If it's a singular test, you can supply any arguments you want to version: 2
models:
- name: my_model
columns:
- name: id
tests:
- unique:
config:
whatever_i_want: custom_value # i.e. for use in a custom 'test' materialization For the second, it varies by config:
|
Would it be possible to also use the Snowflake warehouse defined for the model when we use run_query too? e.g. https://getdbt.slack.com/archives/CJN7XRF1B/p1633667936442800?thread_ts=1633666825.441600&cid=CJN7XRF1B |
My comment above described two components needed for this change:
If both of those changes are made in |
I've turned the comment above into a new issue in I'm going to close this issue, since I believe all the remaining changes are required in |
picks up from dbt-labs/dbt-core#2981
Describe the feature
Many model configs are model only, but some are also relevant for tests! There are two Snowflake examples that come immediately to mind:
snowflake_warehouse
: Run this test with a different warehouse (= compute resource) from thetarget.warehouse
configured in the profilequery_tag
: Slap a query tag on this test that differs from the default query tagI like these because each represents a different type of change to achieve parity:
snowflake_warehouse
config is executed as a python hook before and after calling the materialization. (I'm not entirely sure why). I think we'd just need to add these lines to the test task:https://github.com/fishtown-analytics/dbt/blob/7ec5c122e17ab7e1a5dd1e1cab36527159564a0f/core/dbt/task/run.py#L246-L250
(In all likelihood, we should rename those hooks to something more generic, and add them to all the other task types, too.)
set_query_tag()
andunset_query_tag()
macros. The Snowflaketest
materialization could handle this with ease:https://github.com/fishtown-analytics/dbt/blob/7ec5c122e17ab7e1a5dd1e1cab36527159564a0f/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql#L3
https://github.com/fishtown-analytics/dbt/blob/7ec5c122e17ab7e1a5dd1e1cab36527159564a0f/plugins/snowflake/dbt/include/snowflake/macros/materializations/table.sql#L38
Of course, in order for this to work, tests first need to be able to "carry" these configs. Then, in all the ways described by dbt-labs/dbt-core#3253, those configs can be set in-file
config()
blocks, inherited, set indbt_project.yml
, etc.The text was updated successfully, but these errors were encountered: