Skip to content

Commit

Permalink
Make latest balances incremental
Browse files Browse the repository at this point in the history
  • Loading branch information
aalan3 committed Jul 6, 2024
1 parent 163d1a9 commit 554dec3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions solana/models/solana_utils/solana_utils_latest_balances.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
config(
schema = 'solana_utils',
alias = 'latest_balances',
materialized='table',

materialized='incremental',
file_format = 'delta',
incremental_strategy = 'merge',
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')],
unique_key = ['address', 'token_mint_address', 'token_balance_owner']
post_hook='{{ expose_spells(\'["solana"]\',
"sector",
"solana_utils",
Expand All @@ -21,6 +24,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
Expand Down

0 comments on commit 554dec3

Please sign in to comment.