diff --git a/README.md b/README.md index 8445681..b6d5408 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,17 @@ Default values are False * Usage: dbt run --var '{"UPDATE_UDFS_AND_SPS":True}' -m ... +To reload records in a curated complete table without a full-refresh, such as `silver_bridge.complete_bridge_activity`: +* HEAL_CURATED_MODEL +Default is an empty array [] +When item is included in var array [], incremental logic will be skipped for that CTE / code block +When item is not included in var array [] or does not match specified item in model, incremental logic will apply +Example set up: `{% if is_incremental() and 'axelar' not in var('HEAL_CURATED_MODEL') %}` + +* Usage: +Single CTE: dbt run --var '{"HEAL_CURATED_MODEL":"axelar"}' -m ... +Multiple CTEs: dbt run --var '{"HEAL_CURATED_MODEL":["axelar","across","celer_cbridge"]}' -m ... + ### Resources: - Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction) - Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers diff --git a/dbt_project.yml b/dbt_project.yml index cf01b93..7964817 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -67,6 +67,7 @@ vars: BALANCES_START: 0 BALANCES_END: 15000000 HEAL_MODEL: False + HEAL_CURATED_MODEL: [] DROP_UDFS_AND_SPS: False START_GHA_TASKS: False STUDIO_TEST_USER_ID: '{{ env_var("STUDIO_TEST_USER_ID", "98d15c30-9fa5-43cd-9c69-3d4c0bb269f5") }}' diff --git a/models/silver/defi/bridge/axelar/silver_bridge__axelar_contractcallwithtoken.sql b/models/silver/defi/bridge/axelar/silver_bridge__axelar_contractcallwithtoken.sql index f506bab..4e5df72 100644 --- a/models/silver/defi/bridge/axelar/silver_bridge__axelar_contractcallwithtoken.sql +++ b/models/silver/defi/bridge/axelar/silver_bridge__axelar_contractcallwithtoken.sql @@ -111,7 +111,10 @@ transfers AS ( {{ ref('silver__transfers') }} WHERE from_address = '0xce16f69375520ab01377ce7b88f5ba8c48f8d666' - AND to_address = '0x6f015f16de9fc8791b234ef68d486d2bf203fba8' + AND to_address IN ( + '0x6f015f16de9fc8791b234ef68d486d2bf203fba8', + '0x0000000000000000000000000000000000000000' + ) {% if is_incremental() %} AND _inserted_timestamp >= ( @@ -137,7 +140,7 @@ FINAL AS ( b.tx_status, b.contract_address AS bridge_address, b.name AS platform, - b.sender, + b.origin_from_address AS sender, CASE WHEN b.recipient = '0x0000000000000000000000000000000000000000' THEN refundAddress ELSE b.recipient diff --git a/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql b/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql index e7a7df5..a9fbd6b 100644 --- a/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql +++ b/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql @@ -33,7 +33,7 @@ WITH across AS ( FROM {{ ref('silver_bridge__across_fundsdeposited') }} -{% if is_incremental() %} +{% if is_incremental() and 'across' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -69,7 +69,7 @@ allbridge AS ( FROM {{ ref('silver_bridge__allbridge_sent') }} -{% if is_incremental() %} +{% if is_incremental() and 'allbridge' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -105,7 +105,7 @@ axelar AS ( FROM {{ ref('silver_bridge__axelar_contractcallwithtoken') }} -{% if is_incremental() %} +{% if is_incremental() and 'axelar' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -141,7 +141,7 @@ celer_cbridge AS ( FROM {{ ref('silver_bridge__celer_cbridge_send') }} -{% if is_incremental() %} +{% if is_incremental() and 'celer_cbridge' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -177,7 +177,7 @@ hop AS ( FROM {{ ref('silver_bridge__hop_transfersent') }} -{% if is_incremental() %} +{% if is_incremental() and 'hop' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -213,7 +213,7 @@ meson AS ( FROM {{ ref('silver_bridge__meson_transfers') }} -{% if is_incremental() %} +{% if is_incremental() and 'meson' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -249,7 +249,7 @@ multichain AS ( FROM {{ ref('silver_bridge__multichain_v7_loganyswapout') }} -{% if is_incremental() %} +{% if is_incremental() and 'multichain' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -285,7 +285,7 @@ stargate AS ( FROM {{ ref('silver_bridge__stargate_swap') }} -{% if is_incremental() %} +{% if is_incremental() and 'stargate' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -321,7 +321,7 @@ symbiosis AS ( FROM {{ ref('silver_bridge__symbiosis_synthesizerequest') }} -{% if is_incremental() %} +{% if is_incremental() and 'symbiosis' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -357,7 +357,7 @@ synapse_tb AS ( FROM {{ ref('silver_bridge__synapse_token_bridge') }} -{% if is_incremental() %} +{% if is_incremental() and 'synapse_tb' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -393,7 +393,7 @@ synapse_tbs AS ( FROM {{ ref('silver_bridge__synapse_tokenbridgeandswap') }} -{% if is_incremental() %} +{% if is_incremental() and 'synapse_tbs' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT @@ -429,7 +429,7 @@ wormhole AS ( FROM {{ ref('silver_bridge__wormhole_transfers') }} -{% if is_incremental() %} +{% if is_incremental() and 'wormhole' not in var('HEAL_CURATED_MODEL') %} WHERE _inserted_timestamp >= ( SELECT