near-models/models/gold/price/price__ez_prices_hourly.sql
2025-08-11 13:50:07 -04:00

48 lines
984 B
SQL

{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['scheduled_non_core']
) }}
SELECT
HOUR,
token_address,
symbol,
NAME,
decimals,
price,
blockchain,
FALSE AS is_native,
is_deprecated,
is_imputed,
COALESCE(is_verified, FALSE) AS token_is_verified,
inserted_timestamp,
modified_timestamp,
complete_token_prices_id AS ez_prices_hourly_id
FROM
{{ ref('silver__complete_token_prices') }}
WHERE
lower(blockchain) IN ('near', 'near protocol')
UNION ALL
SELECT
HOUR,
NULL AS token_address,
symbol,
NAME,
decimals,
price,
blockchain,
TRUE AS is_native,
is_deprecated,
is_imputed,
TRUE AS token_is_verified,
inserted_timestamp,
modified_timestamp,
complete_native_prices_id AS ez_prices_hourly_id
FROM
{{ ref('silver__complete_native_prices') }}
WHERE
blockchain = 'near protocol'
AND symbol = 'NEAR'