diff --git a/models/marts/enriched_history_operations.sql b/models/marts/enriched_history_operations.sql index 35d4e32..0648e38 100644 --- a/models/marts/enriched_history_operations.sql +++ b/models/marts/enriched_history_operations.sql @@ -38,6 +38,7 @@ with {% 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 date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) + {% endif %} ) , history_transactions as ( @@ -194,6 +195,7 @@ with {% 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 date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day) + {% endif %} ) diff --git a/models/marts/fee_stats_agg.sql b/models/marts/fee_stats_agg.sql index fe9d99c..dabbd65 100644 --- a/models/marts/fee_stats_agg.sql +++ b/models/marts/fee_stats_agg.sql @@ -1,6 +1,10 @@ {{ config( materialized='incremental', - unique_key=["day_agg"] + unique_key=["day_agg"], + partition_by={ + "field": "day_agg" + , "data_type": "date" + , "granularity": "month"} ) }}