batch_last_run_date

{% macro batch_last_run_date() %}
  {% set sql %}
     select max(job_start_time)::varchar as Last_Batch_Start_Time from {{ target.database }}.LOGGING.PLATFORM_LOGS
     where  batch_name='master_batch'
     and batch_run_id not in(select batch_run_id
                             from  {{ target.database }}.LOGGING.PLATFORM_LOGS
                             where job_status='Failed'
                             and  batch_name='master_batch');
  {% endset %}  
  {% if execute %}
  {% set results = run_query(sql) %}
  {{return(results[0][0])}}
  /*{% do results.print_table() %}*/
  {% endif %}
{%- endmacro %}