mirror of
https://github.com/FlipsideCrypto/eclipse-models.git
synced 2026-02-06 17:26:49 +00:00
move to secrets (#30)
This commit is contained in:
parent
9aa8d68c13
commit
1cf7990c12
@ -1,4 +1,4 @@
|
||||
-- depends_on: {{ ref('streamline__node_min_block_available') }}
|
||||
-- depends_on: {{ ref('streamline__node_min_block_available') }}
|
||||
{{ config (
|
||||
materialized = "view",
|
||||
post_hook = fsc_utils.if_data_call_function_v2(
|
||||
@ -16,26 +16,30 @@
|
||||
|
||||
{% if execute %}
|
||||
{% set min_block_query %}
|
||||
SELECT min(block_id) FROM {{ ref('streamline__node_min_block_available') }}
|
||||
{% endset %}
|
||||
|
||||
{% set min_block_id = run_query(min_block_query)[0][0] %}
|
||||
{% endif %}
|
||||
SELECT
|
||||
MIN(block_id)
|
||||
FROM
|
||||
{{ ref('streamline__node_min_block_available') }}
|
||||
|
||||
WITH blocks AS (
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref("streamline__blocks") }}
|
||||
WHERE
|
||||
/* Find the earliest block available from the node provider */
|
||||
block_id >= 6572203
|
||||
EXCEPT
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('streamline__block_txs_complete') }}
|
||||
)
|
||||
{% endset %}
|
||||
{% set min_block_id = run_query(min_block_query) [0] [0] %}
|
||||
{% endif %}
|
||||
|
||||
WITH blocks AS (
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref("streamline__blocks") }}
|
||||
WHERE
|
||||
/* Find the earliest block available from the node provider */
|
||||
block_id >= 6572203
|
||||
EXCEPT
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('streamline__block_txs_complete') }}
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
ROUND(
|
||||
@ -44,7 +48,7 @@ SELECT
|
||||
) :: INT AS partition_key,
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'https://eclipse.lgns.net:443',
|
||||
'{Service}',
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json'
|
||||
@ -63,16 +67,17 @@ SELECT
|
||||
'encoding',
|
||||
'jsonParsed',
|
||||
'rewards',
|
||||
False,
|
||||
FALSE,
|
||||
'transactionDetails',
|
||||
'full',
|
||||
'maxSupportedTransactionVersion',
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'Vault/prod/eclipse/mainnet'
|
||||
) AS request
|
||||
FROM
|
||||
blocks
|
||||
ORDER BY
|
||||
block_id
|
||||
block_id
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
-- depends_on: {{ ref('streamline__node_min_block_available') }}
|
||||
-- depends_on: {{ ref('streamline__node_min_block_available') }}
|
||||
{{ config (
|
||||
materialized = "view",
|
||||
post_hook = fsc_utils.if_data_call_function_v2(
|
||||
@ -15,26 +15,30 @@
|
||||
|
||||
{% if execute %}
|
||||
{% set min_block_query %}
|
||||
SELECT min(block_id) FROM {{ ref('streamline__node_min_block_available') }}
|
||||
{% endset %}
|
||||
|
||||
{% set min_block_id = run_query(min_block_query)[0][0] %}
|
||||
{% endif %}
|
||||
SELECT
|
||||
MIN(block_id)
|
||||
FROM
|
||||
{{ ref('streamline__node_min_block_available') }}
|
||||
|
||||
WITH blocks AS (
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref("streamline__blocks") }}
|
||||
WHERE
|
||||
/* Find the earliest block available from the node provider */
|
||||
block_id >= {{ min_block_id }}
|
||||
EXCEPT
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('streamline__blocks_complete') }}
|
||||
)
|
||||
{% endset %}
|
||||
{% set min_block_id = run_query(min_block_query) [0] [0] %}
|
||||
{% endif %}
|
||||
|
||||
WITH blocks AS (
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref("streamline__blocks") }}
|
||||
WHERE
|
||||
/* Find the earliest block available from the node provider */
|
||||
block_id >= {{ min_block_id }}
|
||||
EXCEPT
|
||||
SELECT
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('streamline__blocks_complete') }}
|
||||
)
|
||||
SELECT
|
||||
block_id,
|
||||
ROUND(
|
||||
@ -43,7 +47,7 @@ SELECT
|
||||
) :: INT AS partition_key,
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'https://eclipse.lgns.net:443',
|
||||
'{Service}',
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json'
|
||||
@ -62,14 +66,15 @@ SELECT
|
||||
'encoding',
|
||||
'jsonParsed',
|
||||
'rewards',
|
||||
False,
|
||||
FALSE,
|
||||
'transactionDetails',
|
||||
'none',
|
||||
'maxSupportedTransactionVersion',
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'Vault/prod/eclipse/mainnet'
|
||||
) AS request
|
||||
FROM
|
||||
blocks
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'https://eclipse.lgns.net:443',
|
||||
'{Service}',
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json',
|
||||
@ -22,5 +22,6 @@ SELECT
|
||||
'getSlot',
|
||||
'params',
|
||||
[]
|
||||
)
|
||||
) :data :result :: INT AS block_id
|
||||
),
|
||||
'Vault/prod/eclipse/mainnet'
|
||||
) :data :result :: INT AS block_id
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
) }}
|
||||
|
||||
{% set block_to_check = 0 %}
|
||||
|
||||
WITH node_response AS (
|
||||
|
||||
SELECT
|
||||
{{ target.database }}.live.udf_api(
|
||||
'POST',
|
||||
'https://eclipse.lgns.net:443',
|
||||
'{Service}',
|
||||
OBJECT_CONSTRUCT(
|
||||
'Content-Type',
|
||||
'application/json'
|
||||
@ -28,24 +28,27 @@ WITH node_response AS (
|
||||
'encoding',
|
||||
'jsonParsed',
|
||||
'rewards',
|
||||
False,
|
||||
FALSE,
|
||||
'transactionDetails',
|
||||
'none',
|
||||
'maxSupportedTransactionVersion',
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
) AS data
|
||||
),
|
||||
'Vault/prod/eclipse/mainnet'
|
||||
) AS DATA
|
||||
)
|
||||
SELECT
|
||||
data:data:error:code::int AS error_code,
|
||||
data:data:error:message::string AS error_message,
|
||||
SELECT
|
||||
DATA :data :error :code :: INT AS error_code,
|
||||
DATA :data :error :message :: STRING AS error_message,
|
||||
CASE
|
||||
WHEN error_code = -32001 THEN
|
||||
split_part(error_message,'available block: ',2)::int
|
||||
ELSE
|
||||
{{ block_to_check }}
|
||||
WHEN error_code = -32001 THEN SPLIT_PART(
|
||||
error_message,
|
||||
'available block: ',
|
||||
2
|
||||
) :: INT
|
||||
ELSE {{ block_to_check }}
|
||||
END AS block_id
|
||||
FROM
|
||||
node_response
|
||||
FROM
|
||||
node_response
|
||||
|
||||
Loading…
Reference in New Issue
Block a user