diff --git a/models/streamline/core/realtime/streamline__chunks_realtime.sql b/models/streamline/core/realtime/streamline__chunks_realtime.sql index 090a0cd..8778185 100644 --- a/models/streamline/core/realtime/streamline__chunks_realtime.sql +++ b/models/streamline/core/realtime/streamline__chunks_realtime.sql @@ -21,6 +21,20 @@ ) }} WITH +{% if var('STREAMLINE_GAPFILL', false) %} +tbl AS ( + SELECT + A.block_id, + A.block_timestamp_epoch, + A.chunk_hash + FROM + {{ ref('seeds__impacted_blocks') }} C + LEFT JOIN {{ ref('streamline__chunks') }} A ON A.block_id = C.block_id + LEFT JOIN {{ ref('streamline__chunks_complete') }} B ON A.chunk_hash = B.chunk_hash + WHERE + B.chunk_hash IS NULL +) +{% else %} {% if var('STREAMLINE_BACKFILL', false) %} last_3_days AS ( SELECT @@ -54,6 +68,7 @@ tbl AS ( ) AND B.chunk_hash IS NULL ) +{% endif %} SELECT block_id, block_timestamp_epoch, diff --git a/models/streamline/core/realtime/streamline__transactions_realtime.sql b/models/streamline/core/realtime/streamline__transactions_realtime.sql index 6371f7b..0fd5d88 100644 --- a/models/streamline/core/realtime/streamline__transactions_realtime.sql +++ b/models/streamline/core/realtime/streamline__transactions_realtime.sql @@ -21,6 +21,26 @@ ) }} WITH +{% if var('STREAMLINE_GAPFILL', false) %} +tbl AS ( + SELECT + A.block_id, + A.block_timestamp_epoch, + A.tx_hash, + A.signer_id, + A.shard_id, + A.chunk_hash, + A.height_created, + A.height_included + FROM + {{ ref('seeds__impacted_blocks') }} C + LEFT JOIN {{ ref('streamline__transactions') }} A ON A.block_id = C.block_id + LEFT JOIN {{ ref('streamline__transactions_complete') }} B ON A.tx_hash = B.tx_hash + WHERE + B.tx_hash IS NULL + AND A.signer_id IS NOT NULL +) +{% else %} {% if var('STREAMLINE_BACKFILL', false) %} last_3_days AS ( SELECT @@ -60,6 +80,7 @@ tbl AS ( AND A.signer_id IS NOT NULL AND B.tx_hash IS NULL ) +{% endif %} SELECT shard_id, chunk_hash,