cosmos-models/models/silver/streamline/streamline__blocks_realtime.sql
Ryan-Loofy 3bfdba7ebf
Initial commit for Cosmos DBT Project (#1)
* Initial commit for Cosmos DBT Project

* Add gitignore

* Removed dbt packages

* Removed dbt logs

* Delete target

* Remove DS_Stores

* Delete ds_store
2022-11-09 09:19:00 -05:00

33 lines
681 B
SQL

{{ config (
materialized = "view",
post_hook = if_data_call_function(
func = "{{this.schema}}.udf_get_cosmos_blocks(object_construct('sql_source', '{{this.identifier}}'))",
target = "{{this.schema}}.{{this.identifier}}"
)
) }}
SELECT
{{ dbt_utils.surrogate_key(
['block_number']
) }} AS id,
block_number
FROM
{{ ref("streamline__blocks") }}
WHERE
block_number > 12000000
AND block_number IS NOT NULL
EXCEPT
SELECT
id,
block_number
FROM
{{ ref("streamline__complete_blocks") }}
WHERE
block_number > 12000000
{# UNION ALL
SELECT
id,
block_number
FROM
{{ ref("streamline__blocks_history") }} #}