From 73018f8233480756f01f5c7aad922177e80629f9 Mon Sep 17 00:00:00 2001 From: drethereum Date: Wed, 17 Jan 2024 09:35:16 -0700 Subject: [PATCH] heal var --- README.md | 11 ++++++++++ dbt_project.yml | 1 + ...ilver_bridge__complete_bridge_activity.sql | 20 +++++++++---------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 97adfb7..33d8893 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,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 39d062a..dfa364f 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -65,6 +65,7 @@ vars: OBSERV_FULL_TEST: False WAIT: 0 HEAL_MODEL: False + HEAL_CURATED_MODEL: [] START_GHA_TASKS: False API_INTEGRATION: '{{ var("config")[target.name]["API_INTEGRATION"] if var("config")[target.name] else var("config")["dev"]["API_INTEGRATION"] }}' EXTERNAL_FUNCTION_URI: '{{ var("config")[target.name]["EXTERNAL_FUNCTION_URI"] if var("config")[target.name] else var("config")["dev"]["EXTERNAL_FUNCTION_URI"] }}' 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 1aea532..2c8bb67 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 @@ 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 @@ -105,7 +105,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 @@ -141,7 +141,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 @@ -177,7 +177,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 @@ -213,7 +213,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 @@ -249,7 +249,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 @@ -285,7 +285,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 @@ -321,7 +321,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 @@ -357,7 +357,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