From ab8516eb63d125a15053a94da56ccbfacbb9a550 Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Thu, 24 Jul 2025 15:49:13 -0400 Subject: [PATCH] lim 10 --- models/bronze/bronze_api__coin_metadata.sql | 32 ++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/models/bronze/bronze_api__coin_metadata.sql b/models/bronze/bronze_api__coin_metadata.sql index aa97a5b..cf8f021 100644 --- a/models/bronze/bronze_api__coin_metadata.sql +++ b/models/bronze/bronze_api__coin_metadata.sql @@ -9,25 +9,31 @@ WITH coins AS ( SELECT - coin_type + A.coin_type FROM - {{ ref('silver__coin_types') }} + {{ ref('silver__coin_types') }} A {% if is_incremental() %} -EXCEPT -SELECT - coin_type -FROM - {{ this }} +LEFT JOIN ( + SELECT + coin_type + FROM + {{ this }} + {# WHERE + decimals IS NOT NULL --rerun if decimals is null and inserted_timestamp is within the last 7 days (if the token still doesnt have decimals after 7 day then we will stop trying) + OR ( + decimals IS NULL + AND inserted_timestamp < CURRENT_DATE -7 + ) #} +) b +ON A.coin_type = b.coin_type WHERE - decimals IS NOT NULL --rerun if decimals is null and inserted_timestamp is within the last 7 days (if the token still doesnt have decimals after 7 day then we will stop trying) - OR ( - decimals IS NULL - AND inserted_timestamp < CURRENT_DATE -7 - ) + b.coin_type IS NULL {% endif %} +ORDER BY + inserted_timestamp DESC LIMIT - 100 + 10 ), lq AS ( SELECT coin_type,