Tests
Apply tests to check the integrity and quality of your assets.
Overview
Tests can be applied to either sources or models, allowing you to verify your data at every build step against specified rules or assertions.
Y42 provides two types of tests:
- Table tests: assertions applicable at the table level, e.g. if the table row count is within a certain range or if the table includes specific columns.
- Column tests: assertions applicable at the column level, e.g. unique, not null, or containing certain values.
To define your own customized tests, add them to the tests
folder.
You can customize the location of this folder by modifying the test-paths
configuration in the dbt_project.yml
file.
Test execution
All tests are converted into SQL select
queries before being executed.
Each query returns rows that fail to meet the specified test criteria.
Hence, if the test's query returns at least one row, the test will fail.
Conversely, if the test query does not return any nows, then the test will pass.
Tests run when the respective asset is built. If any test fails, the corresponding asset job is flagged as failed; therefore, the data presented is always linked to the most recent successful run of the asset.