Tests are configurable from dbt_project.yml #3253
Labels
1.0.0
Issues related to the 1.0.0 release of dbt
dbt tests
Issues related to built-in dbt testing functionality
enhancement
New feature or request
Milestone
Describe the feature
This issue brings tests up to parity with other resource types in terms of being able to configure them from
dbt_project.yml
. In particular, this is essential for being able to control the behavior of tests installed from packages.dbt_project.yml
What does it mean to configure...
test/my_test.sql
)? Same it does today when I put{{ config(severity = 'warn') }}
at the top oftest/my_test.sql
.unique
)? I should be able to add either{{ config(severity = 'warn') }}
to my test block definition, orseverity=warn
as a default argument in the test signature. All specific instances of theunique
test will now be warn-severity by default, unless the specific test overrides as below. (Note: There was a regression for this in v0.19.1, see v0.19.1 test severity='warn' ignored #3240).unique_model_a_id
)? Same as it does today when I add an "argument" to the test definition:In this way, for generic tests, configs are like a special type of test block (macro) argument. You could think about this issue as being a way to "pass" arguments to a bunch of instantiated generic tests all at once, right from
dbt_project.yml
. That said, there are a few differences between configs and arguments for generic tests:values
foraccepted_values
)dbt_project.yml
unique_id
is constructed for a specific test node (see Better unique_id construction for specific instances of generic tests #3254)Hierarchy
config()
block in a data test, or the value passed to a specific instance of a generic test where it's defined in (e.g.) amodels/*.yml
fileconfig()
block or by default arguments in the signature)dbt_project.yml
, applying to all testsEdited: I previously had 2 last, but this is going to be difficult given the way this is implemented today. I don't mind the idea that the generic test's default values are still more specific than
dbt_project.yml
config. I'm also not sure how to think about #3256 relative to the ordering above.Additional context
Today, the only supported configs for tests are
enabled
,severity
, andtags
(docs). Generic tests supportseverity
+tags
, and they shouldenabled
(#3252). We hope to add net-new configs very soon as well (e.g.where
,limit
).The text was updated successfully, but these errors were encountered: