diff --git a/tests/eho_by_ops.sql b/tests/eho_by_ops.sql index 250b527..7dd7c3a 100644 --- a/tests/eho_by_ops.sql +++ b/tests/eho_by_ops.sql @@ -12,18 +12,20 @@ WITH find_missing AS ( SELECT op.op_id, op.batch_run_date, op.batch_id - FROM {{ ref('stg_history_operations') }} op + FROM {{ ref('stg_history_operations') }} cd .. LEFT OUTER JOIN {{ ref('enriched_history_operations') }} eho ON op.op_id = eho.op_id WHERE eho.op_id IS NULL -- Scan only the last 24 hours of data. Alert runs intraday so failures -- are caught and resolved quickly. AND TIMESTAMP(op.batch_run_date) >= TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY ) + AND TIMESTAMP(op.batch_run_date) < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 HOUR ) ), find_max_batch AS ( SELECT MAX(batch_run_date) AS max_batch FROM {{ ref('stg_history_operations') }} WHERE TIMESTAMP(batch_run_date) >= TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY ) + AND TIMESTAMP(batch_run_date) < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 HOUR ) ) SELECT batch_run_date, batch_id,