mirror of
https://github.com/FlipsideCrypto/cosmos-models.git
synced 2026-02-06 13:41:56 +00:00
Some checks failed
docs_update / run_dbt_jobs (push) Has been cancelled
docs_update / notify-failure (push) Has been cancelled
dbt_run_observability / run_dbt_jobs (push) Has been cancelled
dbt_run_observability / notify-failure (push) Has been cancelled
dbt_run_dev_refresh / run_dbt_jobs (push) Has been cancelled
dbt_test_scheduled / run_dbt_jobs (push) Has been cancelled
dbt_test_scheduled / notify-failure (push) Has been cancelled
dbt_run_udf_blockchain / run_dbt_jobs (push) Has been cancelled
dbt_run_udf_blockchain / notify-failure (push) Has been cancelled
42 lines
892 B
SQL
42 lines
892 B
SQL
{{ config(
|
|
materialized = 'incremental',
|
|
unique_key = ['address', 'blockchain'],
|
|
incremental_strategy = 'merge',
|
|
merge_exclude_columns = ["inserted_timestamp"],
|
|
cluster_by = 'modified_timestamp::DATE',
|
|
post_hook = "DELETE FROM {{ this }} WHERE _is_deleted = TRUE;",
|
|
tags = ['daily']
|
|
) }}
|
|
|
|
SELECT
|
|
system_created_at,
|
|
insert_date,
|
|
blockchain,
|
|
address,
|
|
creator,
|
|
label_type,
|
|
label_subtype,
|
|
address_name,
|
|
project_name,
|
|
_is_deleted,
|
|
labels_combined_id,
|
|
SYSDATE() AS inserted_timestamp,
|
|
SYSDATE() AS modified_timestamp,
|
|
'{{ invocation_id }}' AS _invocation_id
|
|
FROM
|
|
{{ source(
|
|
'crosschain_silver',
|
|
'labels_combined'
|
|
) }}
|
|
WHERE
|
|
blockchain = 'cosmos'
|
|
|
|
{% if is_incremental() %}
|
|
AND modified_timestamp >= (
|
|
SELECT
|
|
MAX(modified_timestamp)
|
|
FROM
|
|
{{ this }}
|
|
)
|
|
{% endif %}
|