-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
73 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 52 additions & 5 deletions
57
models/streamline/bronze/beacon/bronze__streamline_beacon_validators.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,55 @@ | ||
{{ config ( | ||
materialized = 'view' | ||
) }} | ||
{{ fsc_evm.streamline_external_table_query( | ||
model = "beacon_validators_v2", | ||
partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 4), '_', 1) AS INTEGER)", | ||
block_number = false | ||
) }} | ||
|
||
WITH meta AS ( | ||
|
||
SELECT | ||
last_modified AS _inserted_timestamp, | ||
file_name, | ||
CAST( | ||
SPLIT_PART(SPLIT_PART(file_name, '/', 4), '_', 1) AS INTEGER | ||
) AS _partition_by_block_id | ||
FROM | ||
TABLE( | ||
information_schema.external_table_file_registration_history( | ||
start_time => DATEADD('day', -3, CURRENT_TIMESTAMP()), | ||
table_name => '{{ source( "bronze_streamline", "beacon_validators") }}') | ||
) A | ||
) | ||
SELECT | ||
block_number, | ||
state_id, | ||
INDEX, | ||
array_index, | ||
b._inserted_timestamp, | ||
{{ dbt_utils.generate_surrogate_key(['block_number', 'index', 'array_index']) }} AS id, | ||
s._partition_by_block_id AS _partition_by_block_id, | ||
DATA | ||
FROM | ||
{{ source( | ||
'bronze_streamline', | ||
'beacon_validators' | ||
) }} | ||
s | ||
JOIN meta b | ||
ON b.file_name = metadata$filename | ||
AND b._partition_by_block_id = s._partition_by_block_id | ||
WHERE | ||
b._partition_by_block_id = s._partition_by_block_id | ||
AND ( | ||
DATA :error :code IS NULL | ||
OR DATA :error :code NOT IN ( | ||
'-32000', | ||
'-32001', | ||
'-32002', | ||
'-32003', | ||
'-32004', | ||
'-32005', | ||
'-32006', | ||
'-32007', | ||
'-32008', | ||
'-32009', | ||
'-32010' | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters