[Feature] Provide the possibility to apply `data_tests` for all models in a certain directory / resource_path
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this your first time submitting a feature request?
- [x] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [x] I have searched the existing issues, and I could not find an existing issue for this feature
- [x] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
### Describe the feature
In case that data_tests need to be applied to a wide range of models, it would be very convenient to be able to define them similar to model configuration options in the `dbt_project.yml` file.
Background:
We have lots of tests to monitor adherence to our style guide, and we would like to apply them to all models under a certain `resource_path`/directory, similar to how one defines model configurations in `dbt_project.yml`. What we propose is something like:
```
dbt_project:
contributed:
+data_tests:
- verify_naming_schema
config: {severity: 'warn'}
```
Since data_tests belong to the model properties category, that is currently not possible to do in `dbt_project.yml`. Maybe there is a possibility to include the data_tests model property in the `dbt_project.yml` file, possibly extending the top-level option for `data_tests` to allow applying tests to directories.
### Describe alternatives you've considered
The alternative is to define data_tests for each model. This has disadvantages (some might be specific to our situation):
- our the model count in our project is already 1300+, so maintenance of (always the same config) is tedious
- new models are being proposed by our user base. In Pull Requests, we would have to verify that all tests are there and unchanged. If these compliance tests are defined by `resource_path`s, they are set as default.
- our `schema.yml` files become quite long and complicated, repeating the same definition over and over.
### Who will this benefit?
* Everyone who wants to define data_tests on the level of `resource_path`s.
* Everyone who wants default data_tests
### Are you interested in contributing this feature?
Yes, but I think there is some critical logic invovled (effectively, model properties can now be defined in two places (`schema.yml`, `dbt_project.yml`), so inheritance needs to be considered).
### Anything else?
This relates to a ~bug~ issue #11472
Contributor guide
Assessment
This issue has not been assessed yet.