mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 13:46:42 +00:00
use hourly grain to better prune data (#443)
This commit is contained in:
parent
ffe9120f46
commit
0458b47dbd
@ -5,8 +5,8 @@
|
||||
{% set model = "decoded_instructions_2" %}
|
||||
{{ streamline_external_table_FR_query(
|
||||
model,
|
||||
partition_function = "to_date(concat_ws('-', split_part(file_name, '/', 3),split_part(file_name, '/', 4), split_part(file_name, '/', 5)))",
|
||||
partition_name = "_partition_by_created_date",
|
||||
partition_function = "to_timestamp_ntz(concat(split_part(file_name, '/', 3),'-',split_part(file_name, '/', 4),'-',split_part(file_name, '/', 5),' ',split_part(file_name, '/', 6),':00:00.000'))",
|
||||
partition_name = "_partition_by_created_date_hour",
|
||||
unique_key = "block_id",
|
||||
other_cols = "tx_id,index,inner_index,program_id,_partition_by_block_id"
|
||||
) }}
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
{% set model = "decoded_instructions_2" %}
|
||||
{{ streamline_external_table_query(
|
||||
model,
|
||||
partition_function = "to_date(concat_ws('-', split_part(file_name, '/', 3),split_part(file_name, '/', 4), split_part(file_name, '/', 5)))",
|
||||
partition_name = "_partition_by_created_date",
|
||||
partition_function = "to_timestamp_ntz(concat(split_part(file_name, '/', 3),'-',split_part(file_name, '/', 4),'-',split_part(file_name, '/', 5),' ',split_part(file_name, '/', 6),':00:00.000'))",
|
||||
partition_name = "_partition_by_created_date_hour",
|
||||
unique_key = "block_id",
|
||||
other_cols = "tx_id,index,inner_index,program_id,_partition_by_block_id"
|
||||
) }}
|
||||
|
||||
@ -53,7 +53,7 @@ WHERE
|
||||
{{ this }}
|
||||
)
|
||||
AND
|
||||
A._partition_by_created_date >= current_date - 1
|
||||
A._partition_by_created_date_hour >= dateadd('hour', -3, MAX(current_timestamp()))
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY tx_id, INDEX, coalesce(inner_index,-1)
|
||||
|
||||
@ -26,6 +26,8 @@ WHERE
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
AND
|
||||
_partition_by_created_date_hour >= dateadd('hour', -3, MAX(current_timestamp()))
|
||||
{% else %}
|
||||
{{ ref('bronze__streamline_FR_decoded_instructions_2') }}
|
||||
{% endif %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user