addressed review comments

This commit is contained in:
Mike Stepanovic 2025-06-12 10:09:53 -06:00
parent 8f605f16de
commit 17ced5f779
7 changed files with 19 additions and 15 deletions

View File

@ -11,7 +11,8 @@
cluster_by = ['block_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_id, tx_id)",
incremental_predicates = [fsc_ibc.standard_predicate()],
tags = ['gold', 'core', 'phase_2']
tags = ['gold', 'core', 'phase_2'],
enabled = false
) }}
SELECT

View File

@ -81,6 +81,8 @@ SELECT
'{{ invocation_id }}' AS _invocation_id
FROM
bronze_blocks
WHERE
block_id is not null
QUALIFY ROW_NUMBER() OVER (
PARTITION BY chain_id,
block_id

View File

@ -1,7 +1,6 @@
{# Get variables #}
{% set vars = return_vars() %}
-- depends_on: {{ ref('bronze__transactions') }}
-- depends_on: {{ ref('bronze__transactions_fr') }}
{{ config (
materialized = "incremental",
incremental_strategy = 'merge',
@ -11,12 +10,15 @@
tags = ['silver', 'core', 'phase_2']
) }}
-- depends_on: {{ ref('bronze__transactions') }}
-- depends_on: {{ ref('bronze__transactions_fr') }}
WITH bronze_transactions AS (
SELECT
VALUE :BLOCK_ID :: INT AS block_id,
VALUE :BLOCK_ID_REQUESTED AS block_id,
TO_TIMESTAMP_NTZ(
DATA:BLOCK_TIMESTAMP::STRING,
VALUE:BLOCK_TIMESTAMP::STRING,
'YYYY_MM_DD_HH_MI_SS_FF3'
) AS block_timestamp,
DATA :hash :: STRING AS tx_id,
@ -38,10 +40,9 @@ WITH bronze_transactions AS (
DATA :tx_result :events AS msgs,
DATA,
partition_key,
DATA :BLOCK_ID_REQUESTED AS block_id_requested,
inserted_timestamp AS _inserted_timestamp,
{{ dbt_utils.generate_surrogate_key(
['block_id_requested', 'tx_id']
['block_id', 'tx_id']
) }} AS transactions_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
@ -53,8 +54,10 @@ WITH bronze_transactions AS (
{% else %}
{{ ref('bronze__transactions_fr') }}
{% endif %}
{% if is_incremental() %}
WHERE
DATA <> PARSE_JSON('[]')
{% if is_incremental() %}
AND
inserted_timestamp >= (
SELECT
MAX(_inserted_timestamp)
@ -68,6 +71,6 @@ SELECT
FROM
bronze_transactions
QUALIFY ROW_NUMBER() OVER (
PARTITION BY block_id_requested, tx_id
PARTITION BY block_id, tx_id
ORDER BY _inserted_timestamp DESC
) = 1

View File

@ -29,6 +29,7 @@ WITH event_attributes AS (
LATERAL FLATTEN(input => e.value:attributes) a
WHERE t.tx_log IS NOT NULL
AND t.tx_succeeded = TRUE
AND IS_OBJECT(PARSE_JSON(t.tx_log))
{% if is_incremental() %}
AND t._inserted_timestamp >= (
SELECT MAX(_inserted_timestamp)

View File

@ -29,8 +29,7 @@ SELECT
'POST',
'{{ vars.GLOBAL_NODE_URL }}',
OBJECT_CONSTRUCT(
'Content-Type', 'application/json',
'fsc-quantum-state', 'streamline'
'Content-Type', 'application/json'
),
OBJECT_CONSTRUCT(
'id', block_id,

View File

@ -68,8 +68,7 @@ numbers AS (
'POST',
'{{ vars.GLOBAL_NODE_URL }}',
OBJECT_CONSTRUCT(
'Content-Type', 'application/json',
'fsc-quantum-state', 'streamline'
'Content-Type', 'application/json'
),
OBJECT_CONSTRUCT(
'id', block_id,

View File

@ -50,8 +50,7 @@ SELECT
'POST',
'{{ vars.GLOBAL_NODE_URL }}',
OBJECT_CONSTRUCT(
'Content-Type', 'application/json',
'fsc-quantum-state', 'streamline'
'Content-Type', 'application/json'
),
OBJECT_CONSTRUCT(
'id', block_id,