rm starting after (#383)

This commit is contained in:
Jack Forgash 2024-11-21 15:04:39 -07:00 committed by GitHub
parent 6117353b5a
commit 31b6d1e4c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 39 deletions

View File

@ -14,7 +14,6 @@ WITH bronze AS (
SELECT
partition_key,
DATA,
VALUE :STARTING_AFTER :: STRING AS starting_after,
VALUE :API_LIMIT :: INTEGER AS api_limit,
ARRAY_SIZE(
DATA :data :: ARRAY
@ -40,7 +39,6 @@ WHERE
SELECT
partition_key,
item_count,
starting_after,
api_limit,
first_item_id AS request_first_item_id,
last_item_id AS request_last_item_id,

View File

@ -1,5 +1,5 @@
-- depends_on: {{ ref('silver_api__storefront_items') }}
{{ config (
materialized = "view",
post_hook = fsc_utils.if_data_call_function_v2(
@ -13,50 +13,15 @@
)
) }}
{% if not var(
'STOREFRONT_INITIAL_RUN',
false
) %}
{% if execute %}
{% set query %}
WITH target_id AS (
SELECT
item_id,
ROW_NUMBER() over (
ORDER BY
partition_key DESC,
INDEX DESC
) AS rn
FROM
{{ ref('silver_api__storefront_items') }}
{# WHERE _inserted_timestamp >= CURRENT_DATE - 3 #}
)
SELECT
item_id
FROM
target_id
WHERE
rn = 2
{% endset %}
{% set starting_after = run_query(query).columns [0].values() [0] %}
{{ log(
"last_id: " ~ starting_after,
info = True
) }}
{% endif %}
{% endif %}
SELECT
{{ var(
'API_LIMIT',
1000
) }} AS api_limit,
'{{ starting_after }}' AS starting_after,
DATE_PART('EPOCH', SYSDATE()) :: INTEGER AS partition_key,
{{ target.database }}.live.udf_api(
'GET',
'{Service}/api/minting/assets' || '?limit=' || api_limit{% if not var('STOREFRONT_INITIAL_RUN', false) %} || '&startingAfter=' || '{{ starting_after }}'{% endif %},
'{Service}/api/minting/assets' || '?limit=' || api_limit,
{ 'x-api-key': '{Authentication}' },
{},
'Vault/prod/flow/snag-api'