diff --git a/models/marts/enriched_history_operations.sql b/models/marts/enriched_history_operations.sql index ddefa85..7445022 100644 --- a/models/marts/enriched_history_operations.sql +++ b/models/marts/enriched_history_operations.sql @@ -36,7 +36,7 @@ with cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day) and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% if is_incremental() %} - and cast(batch_run_date as date) >= date('{{ dbt_airflow_macros.ds() }}') -- batch run is the min bound of a batch + and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% endif %} ) @@ -77,7 +77,7 @@ with cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day) and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% if is_incremental() %} - and cast(batch_run_date as date) >= date('{{ dbt_airflow_macros.ds() }}') -- batch run is the min bound of a batch + and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% endif %} ) @@ -206,7 +206,7 @@ with cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day) and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% if is_incremental() %} - and cast(batch_run_date as date) >= date('{{ dbt_airflow_macros.ds() }}') -- batch run is the min bound of a batch + and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) {% endif %}