native transfers table

This commit is contained in:
drethereum 2024-11-12 13:18:43 -07:00
parent faf3ea405d
commit 08b97f55f0
3 changed files with 22 additions and 9 deletions

View File

@ -1,7 +1,10 @@
{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true }
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'block_number',
cluster_by = ['block_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(trace_address, from_address, to_address)",
tags = ['non_realtime','reorg']
) }}
SELECT
@ -11,7 +14,7 @@ SELECT
tx_position,
trace_index,
identifier, --deprecate
{# trace_address, --new column #}
trace_address, --new column
origin_from_address,
origin_to_address,
origin_function_signature,
@ -22,7 +25,16 @@ SELECT
amount_precise,
amount_usd,
native_transfers_id AS ez_native_transfers_id,
inserted_timestamp,
modified_timestamp
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp
FROM
{{ ref('silver__native_transfers') }}
{% if is_incremental() %}
AND modified_timestamp > (
SELECT
COALESCE(MAX(modified_timestamp), '1970-01-01' :: TIMESTAMP) AS modified_timestamp
FROM
{{ this }}
)
{% endif %}

View File

@ -16,6 +16,8 @@ models:
description: '{{ doc("blast_trace_index") }}'
- name: IDENTIFIER
description: '{{ doc("evm_column_deprecation_notice_identifier") }}'
- name: TRACE_ADDRESS
description: '{{ doc("evm_trace_address") }}'
- name: ORIGIN_FROM_ADDRESS
description: '{{ doc("blast_origin_from") }}'
- name: ORIGIN_TO_ADDRESS

View File

@ -3,7 +3,6 @@
incremental_strategy = 'delete+insert',
unique_key = 'block_number',
cluster_by = ['block_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION",
tags = ['non_realtime','reorg']
) }}
@ -14,7 +13,7 @@ WITH eth_base AS (
block_number,
block_timestamp,
identifier, --deprecate
{# trace_address, --new column #}
trace_address, --new column
from_address,
to_address,
value,
@ -84,7 +83,7 @@ SELECT
block_number,
block_timestamp,
identifier, --deprecate
{# trace_address, --new column #}
trace_address, --new column
origin_from_address,
origin_to_address,
origin_function_signature,