From b7a9f7b95377cbc72180583050a0e7197a3f1374 Mon Sep 17 00:00:00 2001 From: Jack Forgash Date: Tue, 22 Aug 2023 17:22:27 -0600 Subject: [PATCH] activate block hash test and walkback realtime blocks qualify --- .../realtime/streamline__blocks_realtime.sql | 6 +----- tests/tests__block_parent_gap.sql | 11 +++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/models/silver/streamline/realtime/streamline__blocks_realtime.sql b/models/silver/streamline/realtime/streamline__blocks_realtime.sql index b90962dc..7e0afa0f 100644 --- a/models/silver/streamline/realtime/streamline__blocks_realtime.sql +++ b/models/silver/streamline/realtime/streamline__blocks_realtime.sql @@ -45,11 +45,7 @@ WITH last_3_days AS ({% if var('STREAMLINE_RUN_HISTORY') %} last_3_days ) AND block_number IS NOT NULL - ) qualify ROW_NUMBER() over ( - PARTITION BY block_number - ORDER BY - _inserted_timestamp DESC - ) = 1 + ) ) SELECT block_number, diff --git a/tests/tests__block_parent_gap.sql b/tests/tests__block_parent_gap.sql index 9bd43944..21835995 100644 --- a/tests/tests__block_parent_gap.sql +++ b/tests/tests__block_parent_gap.sql @@ -1,13 +1,12 @@ {{ config( - severity = 'error', - enabled = False + severity = 'error' ) }} --- disabled for now as we are testing block gaps by ordinality +-- enabled in addition to sequence gap test to ensure we have the correct blocks by hash WITH silver_blocks AS ( SELECT block_number, - block_number - 1 as missing_block_number, + block_number - 1 AS missing_block_number, block_timestamp, block_hash, previous_block_hash, @@ -16,11 +15,11 @@ WITH silver_blocks AS ( block_number ASC ) AS prior_hash, _partition_by_block_id, - current_timestamp as _test_timestamp + CURRENT_TIMESTAMP AS _test_timestamp FROM {{ ref('silver__blocks') }} WHERE - block_timestamp::date < CURRENT_DATE + block_timestamp :: DATE < CURRENT_DATE ) SELECT *