diff --git a/solana/models/solana_utils/solana_utils_latest_balances.sql b/solana/models/solana_utils/solana_utils_latest_balances.sql index 5f7f5a51867..1d757e3aa5f 100644 --- a/solana/models/solana_utils/solana_utils_latest_balances.sql +++ b/solana/models/solana_utils/solana_utils_latest_balances.sql @@ -2,8 +2,10 @@ config( schema = 'solana_utils', alias = 'latest_balances', - materialized='table', - + materialized='incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['address'], post_hook='{{ expose_spells(\'["solana"]\', "sector", "solana_utils", @@ -21,6 +23,10 @@ WITH , token_balance_owner , row_number() OVER (partition by address order by day desc) as latest_balance FROM {{ ref('solana_utils_daily_balances') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('day')}} + {% endif %} + ) SELECT @@ -32,4 +38,4 @@ SELECT , now() as updated_at FROM updated_balances ub LEFT JOIN {{ ref('solana_utils_token_accounts')}} tk ON tk.address = ub.address -WHERE latest_balance = 1 \ No newline at end of file +WHERE latest_balance = 1