mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 15:02:11 +00:00
adding test
This commit is contained in:
parent
042b516de8
commit
17822d2c86
@ -1,36 +0,0 @@
|
||||
{% test check_mismatch_percentage(model, threshold_percentage) %}
|
||||
|
||||
WITH api_call AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ model }}
|
||||
WHERE
|
||||
_inserted_timestamp = ((SELECT DATE_TRUNC('day', MAX(_inserted_timestamp)) FROM {{ model }}))
|
||||
AND contract = 'A.e4cf4bdc1751c65d.AllDay'
|
||||
),
|
||||
FLATTEN_RES AS (
|
||||
SELECT
|
||||
ARRAY_SIZE(requested_ids) AS requested_ids_length,
|
||||
ARRAY_SIZE(res:data:data:searchMomentNFTsV2:edges) AS res_length
|
||||
FROM
|
||||
api_call
|
||||
),
|
||||
mismatch_calc AS (
|
||||
SELECT
|
||||
*,
|
||||
CASE
|
||||
WHEN requested_ids_length = 0 THEN 0
|
||||
ELSE ABS(requested_ids_length - res_length) / requested_ids_length * 100
|
||||
END AS mismatch_percentage
|
||||
FROM
|
||||
FLATTEN_RES
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
mismatch_calc
|
||||
WHERE
|
||||
mismatch_percentage > {{ threshold_percentage }}
|
||||
|
||||
{% endtest %}
|
||||
@ -1,9 +0,0 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: bronze_api
|
||||
database: SILVER
|
||||
schema: NFT_ALLDAY_METADATA_S
|
||||
tests:
|
||||
- check_mismatch_percentage:
|
||||
threshold_percentage: 50
|
||||
Loading…
Reference in New Issue
Block a user