{% macro update_A_WORKFLOW_HISTORY(process_end, status) %}
{% if execute %}

    {% set update_table %}
        UPDATE {{ source('control_tables', 'A_WORKFLOW_HISTORY') }}
        SET WORKFLOW_END = {{ process_end }}, 
            WORKFLOW_SUCCESSFUL = '{{ status }}'
        WHERE ORCHESTRATION_RUN_ID = '{{ var("orchestration_run_id") }}'
    {% endset %}

    {% do run_query(update_table) %}

{% endif %}
{% endmacro %}