An 5719/resume traces (#394)

* silver traces

* fr

* quali

* 2 workers
This commit is contained in:
Austin 2025-01-23 10:47:47 -05:00 committed by GitHub
parent 6259ca6b2e
commit 007d2d6ccd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 26 deletions

View File

@ -1,4 +1,5 @@
-- depends_on: {{ ref('bronze_evm__traces') }}
-- depends_on: {{ ref('bronze_evm__FR_traces') }}
{{ config (
materialized = "incremental",
@ -6,43 +7,40 @@
unique_key = "block_number",
cluster_by = ['modified_timestamp::DATE','partition_key'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)",
enabled = false,
tags = ['evm']
) }}
WITH base AS (
WITH bronze_traces AS (
SELECT
block_number,
partition_key,
value:array_index::INT AS tx_position,
DATA :result AS full_traces,
_inserted_timestamp
FROM
{{ ref('bronze_evm__traces') }}
WHERE DATA :result IS NOT NULL
{% if is_incremental()%}
and _inserted_timestamp >= (
SELECT
COALESCE(MAX(_inserted_timestamp), '1900-01-01') _inserted_timestamp
FROM
{{ this }}
)
{% endif %}
{{ ref('bronze_evm__traces') }}
WHERE
DATA :result IS NOT NULL
AND _inserted_timestamp >= (
SELECT
COALESCE(MAX(_inserted_timestamp), '1900-01-01') _inserted_timestamp
FROM
{{ this }}
)
{% else %}
{{ ref('bronze_evm__FR_traces') }}
WHERE DATA :result IS NOT NULL
{% endif %}
qualify(ROW_NUMBER() over (PARTITION BY block_number, tx_position
ORDER BY
_inserted_timestamp DESC)) = 1
qualify(ROW_NUMBER() over (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1
),
bronze_traces AS (
select
block_number,
partition_key,
index as tx_position,
value:result as full_traces,
_inserted_timestamp
from base,
lateral flatten (input=>full_traces)
),
flatten_traces AS (
SELECT
block_number,

View File

@ -5,12 +5,11 @@
target = "{{this.schema}}.{{this.identifier}}",
params ={ "external_table" :"evm_traces_v2",
"sql_limit" :"25000",
"producer_batch_size" :"5000",
"producer_batch_size" :"2000",
"worker_batch_size" :"1000",
"sql_source" :"{{this.identifier}}",
"exploded_key": tojson(["result"])}
),
enabled = false,
tags = ['streamline_realtime_evm']
) }}