diff --git a/models/staging/xedotcom/stg_xedotcom__exchange_rates.sql b/models/staging/xedotcom/stg_xedotcom__exchange_rates.sql index e1c24ed..9bf1948 100644 --- a/models/staging/xedotcom/stg_xedotcom__exchange_rates.sql +++ b/models/staging/xedotcom/stg_xedotcom__exchange_rates.sql @@ -1,3 +1,5 @@ +{{ config(materialized="incremental", unique_key="id_exchange_rate") }} + with raw_exchange_rates as (select * from {{ source("xedotcom", "exchange_rates") }}), stg_xedotcom__exchange_rates as ( @@ -17,3 +19,8 @@ with ) select * from stg_xedotcom__exchange_rates +{% if is_incremental() %} + where + dwh_extracted_at_utc + >= ((select max(dwh_extracted_at_utc) from {{ this }}) - interval '7 days') +{% endif %}