clean lower

This commit is contained in:
Eric Laurello 2025-07-29 11:28:44 -04:00
parent 6a7d62a67e
commit f4f8fa5ec8
2 changed files with 10 additions and 3 deletions

View File

@ -307,7 +307,7 @@ wormhole_secured AS (
{% if is_incremental() %}
AND inserted_timestamp :: DATE >= (
SELECT
MAX(modified_timestamp) :: DATE - 30
MAX(modified_timestamp) :: DATE - 7
FROM
{{ this }}
)
@ -319,7 +319,7 @@ combo AS (
address_lower
FROM
token_base
UNION ALL
UNION
SELECT
blockchain,
token_address_lower

View File

@ -2,6 +2,7 @@
materialized = 'incremental',
unique_key = ['blockchain', 'token_address'],
merge_exclude_columns = ['inserted_timestamp'],
full_refresh = false,
tags = ['daily']
) }}
@ -38,6 +39,7 @@ SELECT
'polygon'
) AS blockchain,
token_address,
LOWER(token_address) AS token_address_lower,
symbol,
cg AS coingecko_id,
{{ dbt_utils.generate_surrogate_key(['blockchain','token_address']) }} AS wormhole_secured_tokens_id,
@ -47,7 +49,12 @@ SELECT
FROM
flat_worms qualify ROW_NUMBER() over (
PARTITION BY blockchain,
token_address
token_address_lower
ORDER BY
--keep the case sensitive token address first
CASE
WHEN token_address_lower = token_address THEN 1
ELSE 0
END,
_inserted_timestamp DESC
) = 1