calogica / dbt-expectations

Port(ish) of Great Expectations to dbt test macros
https://calogica.github.io/dbt-expectations/
Apache License 2.0
1.06k stars 130 forks source link

Q: Possible to used "+" syntax to apply tests to whole directories in dbt_project.yml? #209

Open samLozier opened 1 year ago

samLozier commented 1 year ago

I've been really liking this package, with the possible issue that I'm finding it a little tedious to repeat tests over and over again for each model in a project.

So far I haven't been able to figure out if it's possible to apply a test whole directory in a given project. For example, this would be a project-level sanity check test (currently not working):

#dbt_project.yml

models:
  +tests:
    - dbt_expectations.expect_table_row_count_to_be_between:
        min_value: 1 

Is there a slick way to do something like this, or will I need to write some kind of script to parse/edit yml files in bulk?

clausherther commented 1 year ago

Thanks @samLozier! I hear you on this getting tedious quickly for large projects. Until dbt supports applying tests at the folder level, I think we're stuck with either copy/pasta or using/writing some sort of yaml generator. I think that's a little out of scope for this repo. Is this something we should maybe talk to the https://github.com/dbt-labs/dbt-codegen folks about?