diff --git a/models/marts/dim_products.sql b/models/marts/dim_products.sql index 48d4b25..2d59c92 100644 --- a/models/marts/dim_products.sql +++ b/models/marts/dim_products.sql @@ -1,3 +1,11 @@ +{{ + config( + materialized='incremental', + unique_key='order_id', + incremental_strategy='merge' + ) +}} + with products as ( select * from {{ ref('stg_products') }} @@ -46,3 +54,7 @@ final as ( ) select * from final + +{% if is_incremental() %} +where revenue_date > (select max(revenue_date) from {{ this }}) +{% endif %}