Automating Macro Testing in dbt
I’m working with two interconnected models where the execution of the second model depends on the successful completion of the first. To ensure data integrity, I’ve set up tests using macros within my dbt project. These tests are specified in the schema.yml
file associated with each model.
Here’s a snippet of my schema.yml
:
version: 2
models:
- name: joined_data_cte
columns:
- name: VAP_SIGMA_CM
tests:
- values_less_than_neg_6
# Additional columns and tests...
- name: dev_fatman_dbt
depends_on:
- model: joined_data_cte
Despite setting up post-hooks in the configuration file, the tests aren’t running as intended after the completion of the first model. I’ve also experimented with consolidating all tests into a single macro and invoking it as a hook within the configuration of the first model, but without success.
I’m seeking assistance in troubleshooting this issue. If anyone has experience automating dbt tests or has encountered similar challenges, I’d greatly appreciate your insights and guidance. Thank you in advance for your help!