Files
mars-elt/dbt/macros/control_tables/control_external_run_end.sql
Grzegorz Michalski 2c225d68ac init
2026-03-02 09:47:35 +01:00

22 lines
912 B
SQL

{% macro control_external_run_end() %}
{{ elog("START macro -> control_external_run_end", "INFO", 0)}}
{% if flags.WHICH in ('run', 'seed', 'snapshot', 'build', 'run-operation') %}
{{ elog("Get workflow status", "INFO", 1)}}
{% set status = get_workflow_status() %}
{{ check_null("status", status) }}
{{ elog("Run macro update_A_WORKFLOW_HISTORY", "INFO", 1)}}
{{ update_A_WORKFLOW_HISTORY(convert_timezone(m_current_timestamp('dbt'),'YYYY-MM-DD HH24:MI:SS',''), status) }}
{# {{ elog("Run macro insert_A_MOPDB_LOAD_HISTORY", "INFO", 1)}}
{{ insert_A_MOPDB_LOAD_HISTORY() }}#}
{% do run_query('COMMIT') %}
{% else %}
{{ elog("Flag WHICH " ~ flags.WHICH ~ " is out of the list, do nothing.", "WARN", 1)}}
{% endif %}
{{ elog("END macro -> control_external_run_end", "INFO", 0)}}
{% endmacro %}