The problem I’m having
I have a pre hook and post hook in a model. The pre hook inserts audit information into an admin table. The post hook is intended to update that table when the model succeeds/fails. The post hook works fine when the model succeeds. But if the model fails, the post hook does not get executed.
update_status.sql macro looks like below!
{% macro update_status(modelName) %}
{% if execute %}
{{log("Calling update_status_success()", info=True)}}
{{ update_status_success(modelName) }}
{% else %}
{{log("Calling update_status_failure()",info=True)}}
{{ update_status_failure(modelName) }}
{% endif %}
{% endmacro %}
Is it possible to call the post hook based on whether a model succeeds or fails in the runtime?
Thanks in advance!