sei-models/models/silver/streamline/_max_block_by_date.sql
Ryan-Loofy 1cfa0d3b5e
Sei txs, blocks, tx count pipeline (#2)
* Sei txs, blocks, tx count pipeline

* Streamline sei pipelines

- XXX will be deleted with PROD deployment after approvals
- Temp file will be deleted after UDFs are created

* Add requirement and update block_number to block_id

* Switch to block number

* Remove old sources

* Update loads and run times

* Add prod integration
2023-08-29 12:26:28 -04:00

27 lines
441 B
SQL

{{ config (
materialized = "ephemeral",
unique_key = "block_id",
) }}
WITH base AS (
SELECT
block_timestamp :: DATE AS block_date,
MAX(block_id) as block_number
FROM
{{ ref("silver__blocks") }}
GROUP BY
block_timestamp :: DATE
)
SELECT
block_date,
block_number
FROM
base
WHERE
block_date <> (
SELECT
MAX(block_date)
FROM
base
)