osmosis-models/models/streamline/_max_block_by_date.sql
xiuy001 e4c9432131
Add streamline models (#136)
* updated and added the rest api client and call

* updated

* increased sql limit

* updated params

* refresh

* updated

* updated the rest api call format

* updated

* updated

* updated
2023-09-26 16:03:26 -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
)