From 4a6999c7f2e0fd4f3d072dd36031ab06268d1ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Rodr=C3=ADguez?= Date: Tue, 13 Aug 2024 11:28:09 -0300 Subject: [PATCH] Add block_time and block_slot to solana_utils balances (#6539) * Add block_time and block_slot to solana_utils balances * test: hardcode small time window * fix incremental * Revert "fix incremental" This reverts commit 1a2ed02c5152942285988500288ae390dcba8064. * Revert "test: hardcode small time window" This reverts commit 7ccb1046494a306655e4784c78ab493b9f797c1e. --------- Co-authored-by: jeff-dude --- .../models/solana_utils/solana_utils_daily_balances.sql | 2 ++ .../models/solana_utils/solana_utils_latest_balances.sql | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/dbt_subprojects/solana/models/solana_utils/solana_utils_daily_balances.sql b/dbt_subprojects/solana/models/solana_utils/solana_utils_daily_balances.sql index a928b529e24..ab404ca0ca5 100644 --- a/dbt_subprojects/solana/models/solana_utils/solana_utils_daily_balances.sql +++ b/dbt_subprojects/solana/models/solana_utils/solana_utils_daily_balances.sql @@ -45,6 +45,8 @@ SELECT , token_mint_address , token_balance , token_balance_owner + , block_time + , block_slot , {{ dbt_utils.generate_surrogate_key(['address', 'token_mint_address', 'day']) }} as unique_address_key , now() as updated_at FROM updated_balances diff --git a/dbt_subprojects/solana/models/solana_utils/solana_utils_latest_balances.sql b/dbt_subprojects/solana/models/solana_utils/solana_utils_latest_balances.sql index 1d757e3aa5f..75ed1194fc7 100644 --- a/dbt_subprojects/solana/models/solana_utils/solana_utils_latest_balances.sql +++ b/dbt_subprojects/solana/models/solana_utils/solana_utils_latest_balances.sql @@ -21,6 +21,8 @@ WITH , token_mint_address , token_balance , token_balance_owner + , block_time + , block_slot , row_number() OVER (partition by address order by day desc) as latest_balance FROM {{ ref('solana_utils_daily_balances') }} {% if is_incremental() %} @@ -31,6 +33,8 @@ WITH SELECT ub.address + , ub.block_time + , ub.block_slot , ub.sol_balance , ub.token_balance , coalesce(ub.token_mint_address, tk.token_mint_address) as token_mint_address