near-models/models/silver/prices/silver__complete_token_prices.sql
2024-06-24 19:33:59 -06:00

47 lines
827 B
SQL

{{ config(
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_token_prices_id',
tags = ['scheduled_non_core', 'grail']
) }}
SELECT
HOUR,
LOWER(
p.token_address
) AS token_address,
asset_id,
symbol,
NAME,
decimals,
price,
blockchain,
blockchain_name,
blockchain_id,
is_imputed,
is_deprecated,
provider,
source,
_inserted_timestamp,
inserted_timestamp,
modified_timestamp,
complete_token_prices_id,
_invocation_id
FROM
{{ ref(
'bronze__complete_token_prices'
) }}
p
{% if is_incremental() %}
WHERE
modified_timestamp >= (
SELECT
MAX(
modified_timestamp
)
FROM
{{ this }}
)
{% endif %}