mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
final streamline gap test
This commit is contained in:
parent
862761c380
commit
500f9113d4
1
.github/workflows/dbt_test.yml
vendored
1
.github/workflows/dbt_test.yml
vendored
@ -43,6 +43,7 @@ jobs:
|
||||
- name: Run DBT Jobs
|
||||
run: |
|
||||
dbt test -s models/gold
|
||||
dbt test -s tests__final_gaps
|
||||
continue-on-error: true
|
||||
|
||||
- name: Log test results
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
{{ config(
|
||||
error_if = '>=10',
|
||||
warn_if = 'BETWEEN 1 AND 9',
|
||||
tags = ['gap_test']
|
||||
severity = "error"
|
||||
) }}
|
||||
|
||||
WITH blocks AS (
|
||||
|
||||
69
tests/tests__final_gaps.sql
Normal file
69
tests/tests__final_gaps.sql
Normal file
@ -0,0 +1,69 @@
|
||||
{{ config(
|
||||
severity = "error"
|
||||
) }}
|
||||
|
||||
|
||||
WITH r_receipts AS (
|
||||
SELECT
|
||||
DISTINCT receipt_id,
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('silver__streamline_receipts') }}
|
||||
WHERE
|
||||
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days' AND SYSDATE() - INTERVAL '24 hour'
|
||||
),
|
||||
f_receipts AS (
|
||||
SELECT
|
||||
DISTINCT receipt_object_id,
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('silver__streamline_receipts_final') }}
|
||||
WHERE
|
||||
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days' AND SYSDATE() - INTERVAL '24 hour'
|
||||
),
|
||||
r_transactions AS (
|
||||
SELECT
|
||||
DISTINCT tx_hash,
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('silver__streamline_transactions') }}
|
||||
WHERE
|
||||
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days' AND SYSDATE() - INTERVAL '24 hour'
|
||||
AND
|
||||
_actions[0] is not null
|
||||
),
|
||||
f_transactions AS (
|
||||
SELECT
|
||||
DISTINCT tx_hash,
|
||||
block_id
|
||||
FROM
|
||||
{{ ref('silver__streamline_transactions_final') }}
|
||||
WHERE
|
||||
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days' AND SYSDATE() - INTERVAL '24 hour'
|
||||
)
|
||||
|
||||
SELECT
|
||||
r_receipts.receipt_id AS missing,
|
||||
r_receipts.block_id
|
||||
FROM
|
||||
r_receipts
|
||||
LEFT JOIN
|
||||
f_receipts
|
||||
ON
|
||||
r_receipts.receipt_id = f_receipts.receipt_object_id
|
||||
WHERE
|
||||
f_receipts.receipt_object_id IS NULL
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
r_transactions.tx_hash AS missing,
|
||||
r_transactions.block_id
|
||||
FROM
|
||||
r_transactions
|
||||
LEFT JOIN
|
||||
f_transactions
|
||||
ON
|
||||
r_transactions.tx_hash = f_transactions.tx_hash
|
||||
WHERE
|
||||
f_transactions.tx_hash IS NULL
|
||||
Loading…
Reference in New Issue
Block a user