Skip to content

Commit

Permalink
Limit window to test eho reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Sep 16, 2024
1 parent ee678ca commit 2aac478
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/eho_by_ops.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2aac478

Please sign in to comment.