-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Thorchain gold #8886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thorchain gold #8886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review
or bugbot run
to trigger another review on this PR
|
||
-- Audit fields (Trino conversions) | ||
a._inserted_timestamp, | ||
cast(from_hex(replace(cast(uuid() as varchar), '-', '')) as varchar) AS _audit_run_id, -- Trino equivalent of invocation_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: UUID Function Causes SQL Engine Compatibility Issues
The _audit_run_id
column in several Thorchain gold models uses the uuid()
function, which isn't supported across all SQL engines and can lead to runtime errors. This also creates inconsistent audit IDs within a single dbt run, impacting audit trail reliability. Some implementations further result in unreadable binary characters.
Additional Locations (7)
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_pool_block_statistics.sql#L106-L107
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_pool_block_fees.sql#L46-L47
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_total_block_rewards.sql#L44-L45
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_pool_block_balances.sql#L51-L52
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_daily_tvl.sql#L43-L44
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_rewards_event_entries.sql#L51-L52
dbt_subprojects/daily_spellbook/models/thorchain/gold/thorchain_defi_fact_block_rewards.sql#L44-L45
@@ -0,0 +1,51 @@ | |||
{{ config( | |||
schema = 'thorchain_core', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Schema Misalignment for Thorchain Defi Fact Models
The thorchain_defi_fact_transfers.sql
model is configured with schema = 'thorchain_core'
, conflicting with its thorchain_defi_fact_
naming pattern. This places the model in the wrong schema, deviating from established conventions for thorchain_defi_fact_*
models.
This reverts commit fbb858c.
Thank you for contributing to Spellbook 🪄
Please open the PR in draft and mark as ready when you want to request a review.
Description:
[...]
quick links for more information:
Note
Introduces a Thorchain gold layer: a new
thorchain_core_dim_block
plus extensive core/defi/gov fact tables wired to it, all incremental with deduplication and documented inschema.yml
.thorchain_core_dim_block
(time dims, partitioning, incremental merge) fromthorchain.block_log
.dim_block
)thorchain_core_fact_{transfer,set_mimir,network_version,instantiate,thorname_change,tss_keygen_success,tss_keygen_failure,wasm_contracts}_events
.dim_block
or direct)fact_{active_vault,inactive_vault,affiliate_fee,asgard_fund_yggdrasil,gas,loan_open,loan_repayment,mint_burn,errata,failed_deposit,send,switch,reserve,pending_liquidity,pool,refund,outbound}_events
.fact_{add,withdraw,liquidity_actions,swap_events,swaps,streaming_swap_details}_events
.fact_{pool_block_balances,block_pool_depths,pool_block_statistics,pool_block_fees}
.fact_{rewards_events,rewards_event_entries,total_block_rewards,total_value_locked,daily_tvl,daily_earnings}
.fact_{transfers,upgrades,bond_events,bond_actions}
.fact_scheduled_outbound_events
.dim_block
)thorchain_gov_fact_{new_node,set_version,set_node_mimir,set_node_keys,set_ip_address,validator_request_leave,slash,slash_points}_events
.block_month
,incremental_predicate
), windowed deduplication, surrogate keys, audit fields; several models use Trino-compatible hashing.schema.yml
expansion documenting all new models, columns, and tests (uniqueness/not-null).Written by Cursor Bugbot for commit 3deed56. Configure here.