Enable post-hook testing behavior
Describe the feature
I would like our dmt tool to understand the post-hook behavior that is defined in config block in the model.
I have a source and target model (say dmt__source and dmt__target) and want to see dmt__target and dmt__expected_table is equal due to the post-hook. Here is how my source.yml looks like.
models:
- name: dmt__target
tests:
- dbt_datamocktool.unit_test:
input_mapping:
ref('dmt__source'): ref('dmt__source')
expected_output: ref('dmt__expected_table')
This is how dmt__target looks like.
{{ make_final_model('test_schema', 'dmt__target',
[
'{{ update_id_fields("test_schema", "dmt__target", "id_one") }}',
'{{ update_id_fields("test_schema", "dmt__target", "id_two") }}']) }}
Lastly, this is how macro for the post-hook looks like.
{% macro update_id_fields(schema, table, id_field) %}
UPDATE {{ schema }}_testing.dmt__{{ table }} tbl
...
...
The expected outcome is; through the macro contents in the table will be updated. When I run test, it looks like post-hook is not triggered and I would like to know if this feature is missing in dmt or I miss something. If this feature does not exist yet, then I think it would be a great thing to add.
Describe alternatives you've considered
N/A
Additional context
This is not a database-specific feature request. I'm currently using a Bigquery.
Who will this benefit?
It will be beneficial for anyone who leverages hooks and test their functionality to gain more confidence before shipping to production.