solana-models/tests/test_silver__token_account_owners_recency.sql
tarikceric 9184b7f677
An 4281/token account owners (#501)
* wip

* wip

* add core, clean up

* update per pr comments

* update incremental config

* update logic

* FR model

* logic update for daily fr

* remove model

* recency test for token_account_owners

* refs and sysdate

---------

Co-authored-by: Eric Laurello <eric.laurello@flipsidecrypto.com>
2024-04-04 17:24:02 -07:00

24 lines
448 B
SQL

{{ config(
tags = ["test_daily"]
) }}
WITH most_recent_block AS (
SELECT
MAX(start_block_id) AS recent_block_id
FROM
{{ ref('silver__token_account_owners') }}
)
SELECT
A.recent_block_id,
b.block_id,
b.block_timestamp
FROM
most_recent_block A
LEFT JOIN {{ ref('silver__blocks') }} b
ON A.recent_block_id = b.block_id
WHERE
b.block_timestamp <= (
SYSDATE() - INTERVAL '12 HOUR'
)