update tests (#251)

* update tests

* same threshold
This commit is contained in:
Austin 2024-04-01 23:03:44 -04:00 committed by GitHub
parent be2d16cfc9
commit f56e156f54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 1 deletions

View File

@ -145,3 +145,49 @@ WHERE
FINAL
)
{% endmacro %}
{% macro recent_missing_receipts(
model,
threshold
) %}
WITH txs_base AS (
SELECT
block_number AS base_block_number,
tx_hash AS base_tx_hash
FROM
{{ ref('test_silver__transactions_recent') }}
),
model_name AS (
SELECT
block_number AS model_block_number,
tx_hash AS model_tx_hash
FROM
{{ model }}
),
FINAL AS (
SELECT
base_block_number,
base_tx_hash,
model_block_number,
model_tx_hash
FROM
txs_base
LEFT JOIN model_name
ON base_block_number = model_block_number
AND base_tx_hash = model_tx_hash
WHERE
model_tx_hash IS NULL
OR model_block_number IS NULL
)
SELECT
*
FROM
FINAL
WHERE
(
SELECT
COUNT(*) >= {{ threshold }}
FROM
FINAL
)
{% endmacro %}

View File

@ -9,6 +9,9 @@ models:
partition_by:
- BLOCK_NUMBER
column_name: POSITION
config:
severity: error
error_if: ">10"
columns:
- name: BLOCK_NUMBER
tests:

View File

@ -1,2 +1,2 @@
-- depends_on: {{ ref('test_silver__transactions_recent') }}
{{ recent_missing_txs(ref("test_silver__receipts_recent")) }}
{{ recent_missing_receipts(ref("test_silver__receipts_recent"), 10) }}