{% macro update_A_TASK_HISTORY(a_task_history_key, process_end, status) %}

{% if execute %}

    {% set update_table %}
        UPDATE {{ source('control_tables', 'A_TASK_HISTORY') }}
        SET TASK_END = {{ process_end }},
        TASK_SUCCESSFUL = '{{ status }}'
        WHERE A_TASK_HISTORY_KEY = {{ a_task_history_key }}
    {% endset %}

    {% do run_query(update_table) %}

{% endif %}

{% endmacro %}