move to secrets (#30)

This commit is contained in:
eric-laurello 2024-10-30 10:58:33 -04:00 committed by GitHub
parent 9aa8d68c13
commit 1cf7990c12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 76 additions and 62 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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