Skip to content

Commit

Permalink
axelar fix and var for reload (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
drethereum authored Jan 16, 2024
1 parent bf38804 commit 9c3f54a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ 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
Expand Down
1 change: 1 addition & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ vars:
WAIT: 0
OBSERV_FULL_TEST: False
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"] }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ transfers AS (
from_address = '0xce16f69375520ab01377ce7b88f5ba8c48f8d666'
AND to_address IN (
'0xe19bb3b98f7727c520c757b8a00753eb47358b14',
'0xe432150cce91c13a887f7d836923d5597add8e31'
'0xe432150cce91c13a887f7d836923d5597add8e31',
'0x0000000000000000000000000000000000000000'
)

{% if is_incremental() %}
Expand All @@ -143,7 +144,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -213,7 +213,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
Expand Down Expand Up @@ -249,7 +249,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
Expand Down Expand Up @@ -285,7 +285,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
Expand Down Expand Up @@ -321,7 +321,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
Expand Down Expand Up @@ -357,7 +357,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
Expand Down Expand Up @@ -393,7 +393,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
Expand Down

0 comments on commit 9c3f54a

Please sign in to comment.