blocks (#143)
Some checks failed
docs_update / run_dbt_jobs (push) Has been cancelled
dbt_test_monthly / run_dbt_jobs (push) Has been cancelled
dbt_test_evm_monthly / run_dbt_jobs (push) Has been cancelled
dbt_run_heal_models / run_dbt_jobs (push) Has been cancelled
dbt_test_evm_monthly / notify-failure (push) Has been cancelled
dbt_run_heal_models / notify-failure (push) Has been cancelled
dbt_run_scheduled_scores / run_dbt_jobs (push) Has been cancelled
dbt_test_recent / run_dbt_jobs (push) Has been cancelled
dbt_test_evm_recent / run_dbt_jobs (push) Has been cancelled
dbt_run_scheduled_scores / notify-failure (push) Has been cancelled
dbt_test_evm_recent / notify-failure (push) Has been cancelled
dbt_run_observability_monthly / run_dbt_jobs (push) Has been cancelled

* blocks

* labels
This commit is contained in:
Austin 2025-09-26 10:48:09 -04:00 committed by GitHub
parent 58a185b500
commit 4864d1af7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 149 additions and 18 deletions

View File

@ -0,0 +1,26 @@
{{ config(
materialized = 'view',
tags = ['bronze','labels','evm', 'core']
) }}
SELECT
system_created_at,
insert_date,
blockchain,
address,
creator,
label_type,
label_subtype,
address_name,
project_name,
_is_deleted,
modified_timestamp,
labels_combined_id
FROM
{{ source(
'crosschain_silver',
'labels_combined'
) }}
WHERE
blockchain = 'sei_evm'
AND address LIKE '0x%'

View File

@ -1,20 +1,33 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true }
materialized = 'incremental',
unique_key = ['address', 'blockchain'],
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = 'modified_timestamp::DATE',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address, label_type, label_subtype, address_name, label); DELETE FROM {{ this }} WHERE address in (SELECT address FROM {{ ref('silver_evm__labels') }} WHERE _is_deleted = TRUE);",
tags = ['core']
) }}
select
l.blockchain as blockchain,
l.creator as creator,
evm_address as address,
l.label_type as label_type,
l.label_subtype as label_subtype,
l.label as label,
l.address_name as address_name,
l.dim_labels_id as dim_labels_id,
l.inserted_timestamp as inserted_timestamp,
l.modified_timestamp as modified_timestamp
from {{ ref('core__dim_labels') }} l
join {{ ref('core__dim_address_mapping') }} d
on l.address = d.sei_address
SELECT
blockchain,
creator,
address,
address_name,
label_type,
label_subtype,
project_name AS label,
{{ dbt_utils.generate_surrogate_key(['labels_id']) }} AS dim_labels_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
{{ ref('silver_evm__labels') }} s
{% if is_incremental() %}
WHERE
s.modified_timestamp > (
SELECT
COALESCE(MAX(modified_timestamp), '1970-01-01' :: TIMESTAMP) AS modified_timestamp
FROM
{{ this }}
)
{% endif %}

View File

@ -0,0 +1,38 @@
{{ config(
materialized = 'incremental',
unique_key = ['address', 'blockchain'],
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = 'modified_timestamp::DATE',
tags = ['silver','labels','evm', 'core']
) }}
SELECT
system_created_at,
insert_date,
blockchain,
address,
creator,
label_type,
label_subtype,
address_name,
project_name,
_is_deleted,
{{ dbt_utils.generate_surrogate_key(['labels_combined_id']) }} AS labels_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
{{ ref('bronze_evm__labels') }} b
{% if is_incremental() %}
WHERE
b.modified_timestamp >= (
SELECT
MAX(
modified_timestamp
)
FROM
{{ this }}
)
{% endif %}

View File

@ -0,0 +1,51 @@
version: 2
models:
- name: silver_evm__labels
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- BLOCKCHAIN
- CREATOR
- ADDRESS
where: "not _is_deleted"
columns:
- name: BLOCKCHAIN
tests:
- not_null:
where: "not _is_deleted"
- name: CREATOR
tests:
- not_null:
where: "not _is_deleted"
- name: ADDRESS
tests:
- not_null:
where: "not _is_deleted"
- dbt_expectations.expect_column_values_to_match_regex:
regex: 0[xX][0-9a-fA-F]+
- name: ADDRESS_NAME
tests:
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- name: LABEL_TYPE
tests:
- not_null:
where: "not _is_deleted"
- name: LABEL_SUBTYPE
tests:
- not_null:
where: "not _is_deleted"
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR
- name: PROJECT_NAME
tests:
- not_null:
where: "not _is_deleted"
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- STRING
- VARCHAR

View File

@ -7,3 +7,5 @@ SELECT
*
FROM
{{ ref('silver_evm__confirmed_blocks') }}
WHERE
block_number not in (169970057, 169970054)

View File

@ -13,4 +13,5 @@ WHERE
block_number
FROM
{{ ref("_evm_block_lookback") }}
)
)
and block_number not in (169970057, 169970054)