<@U088WCP3B4P> Is there a way to configure Element...
# ask-elementary-ai
m
@kapa.ai Is there a way to configure Elementary freshness or anomaly tests for all tables in a folder at once, instead of defining them individually for each table?
k
A message from kapa.ai
Based on the knowledge sources, it is not possible to configure Elementary freshness or anomaly tests for all tables in a folder (resource directory) at once using open-source dbt and Elementary. This is a limitation of dbt itself, which requires tests to be defined individually for each model or table in their respective YAML files. There is no native support in dbt or Elementary open source for applying a test globally to all models in a directory, schema, or source—each test must be specified per table or model<sup>[source](https://slack.com/archives/C02CTC89LAX/p1696281462988319)</sup><sup>[source](https://slack.com/archives/C02CTC89LAX/p1686671035677819)</sup><sup>[source](https://slack.com/archives/C02CTC89LAX/p1670863565035799)</sup>. However, Elementary Cloud offers a feature for bulk test configuration via the UI, which allows you to add tests to multiple tables at once and have the cloud platform open a pull request to your code with the necessary changes. This is not available in the open-source version, but it does address the need for bulk or global test configuration<sup>[source](https://docs.elementary-data.com/changelog#add-any-dbt-test-via-ui)</sup><sup>[source](https://slack.com/archives/C02CTC89LAX/p1696281462988319)</sup>. In summary: - Open-source dbt + Elementary: No, you must define tests individually for each table. - Elementary Cloud: Yes, via the UI for bulk test configuration. Let me know if you need more details about the Elementary Cloud option!
m
@kapa.ai in dbt, we can define tests at a folder (or more generally, “model group”) level using YAML inheritance and folder-level configurations.
k
A message from kapa.ai
In dbt, you can use folder-level configurations in your
dbt_project.yml
to set certain configurations (like tags or severity) for groups of models within a folder. However, according to the knowledge sources, this approach does not allow you to define Elementary anomaly or freshness tests themselves at the folder or model group level. The tests must still be explicitly defined for each model in your YAML files. You can use folder-level configuration for some dbt settings (such as severity), but not for adding tests themselves. For example, you can set severity for all models in a folder using:
Copy code
yaml tests:   project_name:     folder_of_models:       +severity: warn
But this does not add the test to all models in the folder; it only sets the configuration for tests that are already defined on those models. You still need to define the actual test for each model individually in your schema YAML files. This is a limitation of dbt and is confirmed by multiple sources in the Elementary community<sup>[source](https://slack.com/archives/C02CTC89LAX/p1685629003685259)</sup><sup>[source](https://slack.com/archives/C02CTC89LAX/p1704886421763019)</sup><sup>[source](https://slack.com/archives/C02CTC89LAX/p1688453123425429)</sup>. In summary: - You can inherit some configurations at the folder level, but you cannot define Elementary tests themselves at the folder/model group level in open-source dbt. - Each test must be explicitly listed for each model. If you need to apply the same test to many models, you might consider scripting the YAML generation or using Elementary Cloud, which offers bulk test configuration via the UI.