Closed graciegoheen closed 4 months ago
@graciegoheen I am working on this now!
Some questions/comments:
# dbt_project.yml
tests:
joel_sandbox:
marts:
+enabled: false
data_tests:
joel_sandbox:
marts:
+enabled: true
I assume not, and you're only allowed one of those?
I just tested this with:
version: 2
models:
- name: dim_wizards
columns:
- name: wizard_id
data_tests:
- unique
- not_null
- name: fct_orders
columns:
- name: order_id
tests:
- unique
- not_null
And that seems to have worked fine. When I ran dbt build
, I get the warning:
[WARNING]: Deprecated functionality
The `tests` config has been renamed to `data_tests`. Please update your
`dbt_project.yml` configuration to reflect this change.
Otherwise, everything runs as expected:
^thinking that's sort of an odd deprecation notice, since in this case I used tests:
in a schema.yml file not in dbt_project.yml
cc: @MichelleArk @gshank
ty! That answers the first question, but my second q's example was in dbt_project.yml
and was providing conflicting configs - what happens if you disable all the tests under the tests
block and enable the same tests under the data_tests
block? I assume something is going to explode and so the JSON Schema should only allow one or the other to exist
@joellabes Indeed!
Added this block to my dbt_project.yml
file:
tests:
+enabled: true
data_tests:
+enabled: false
And got the handy-dandy error:
Turns out it's not easy to have a "if a is defined, b is not allowed to be defined" rule :( so I think I'm going to have to leave this as a compile-time error. but good to know anyway!
With the introduction of unit testing (coming to
dbt-core
in1.8
), we are changing the priortests:
configs todata_tests:
(thoughtests:
with still be supported for backwards compatibility).tests:
todata_tests:
tests:
todata_tests: