An 2569/only retry req 3 times (#98)

* model api responses that resulted in no metadata

* dont try to get metadata after 3 retries

* fix PR comment

* use bronze model per PR
This commit is contained in:
desmond-hui 2022-12-14 17:05:19 -08:00 committed by GitHub
parent c5dc787f21
commit e5863f899a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 5 deletions

View File

@ -7,6 +7,7 @@ SELECT
contract,
DATA,
VALUE,
_inserted_date,
TO_TIMESTAMP_NTZ(SUBSTR(SPLIT_PART(metadata$filename, '/', 4), 1, 10) :: NUMBER, 0) AS _inserted_timestamp
FROM
{{ source(

View File

@ -34,14 +34,37 @@ all_topshots AS (
moment_id
FROM
sales
),
always_null AS (
SELECT
id,
contract,
COUNT(*) AS num_times_null_resp
FROM
{{ ref('streamline__null_moments_metadata') }}
WHERE
contract = 'A.0b2a3299cc857e29.TopShot'
GROUP BY
1,
2
HAVING
num_times_null_resp > 2
)
SELECT
DISTINCT *
FROM
all_topshots
EXCEPT
SELECT
nft_collection as event_contract,
nft_id AS moment_id
FROM
{{ ref('silver__nft_topshot_metadata') }}
(
SELECT
nft_collection AS event_contract,
nft_id AS moment_id
FROM
{{ ref('silver__nft_topshot_metadata') }}
UNION
SELECT
contract,
id
FROM
always_null
)

View File

@ -0,0 +1,31 @@
{{ config(
materialized = 'incremental',
unique_key = ["id","contract","_inserted_date"]
) }}
SELECT
id,
contract,
_inserted_date,
_inserted_timestamp
FROM
{{ ref('bronze__moments_metadata') }}
WHERE
DATA :getMintedMoment :: STRING IS NULL
{% if is_incremental() %}
AND _inserted_date >= (
SELECT
MAX(_inserted_date)
FROM
{{ this }}
)
AND _inserted_timestamp > (
SELECT
MAX(_inserted_timestamp)
FROM
{{ this }}
)
{% else %}
AND _inserted_date >= '2022-12-09'
{% endif %}