diff --git a/macros/stablecoins/stablecoin_breakdown.sql b/macros/stablecoins/stablecoin_breakdown.sql index d876ff44..d17f9cb7 100644 --- a/macros/stablecoins/stablecoin_breakdown.sql +++ b/macros/stablecoins/stablecoin_breakdown.sql @@ -34,8 +34,15 @@ select , sum(case when is_wallet::number = 1 and date = date_trunc('{{granularity}}', date) then stablecoin_supply else 0 end) as p2p_stablecoin_supply {% endif %} from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +{% if is_incremental() %} + where date >= (select dateadd('{{granularity}}', -3, max(date_granularity)) from {{ this }}) +{% endif %} {% if 'application' in breakdowns %} - where application is not null + {% if not is_incremental() %} + where application is not null + {% else %} + and application is not null + {% endif %} {% endif %} group by date_granularity {% for breakdown in breakdowns %}, {{ breakdown }} {% endfor %} order by date_granularity diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown.sql index 6c54ba33..73899a1a 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown.sql @@ -1,4 +1,4 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key="unique_id", snowflake_warehouse="STABLECOIN_V2_LG") }} select date , contract_address @@ -20,4 +20,7 @@ select , is_wallet , unique_id , chain -from {{ ref("agg_daily_stablecoin_breakdown_silver") }} \ No newline at end of file +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +{% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) +{% endif %} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql index e47eca10..28422bfc 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "application"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["application"]) }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_chain.sql index a2ab7d20..b60d9709 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain", "application"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{stablecoin_breakdown(["chain", "application"])}} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_symbol.sql index 9557b6b3..3a0b9cb3 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "application"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{stablecoin_breakdown(["symbol", "application"])}} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql index eae95f8c..372a7bf9 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["category"]) }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql index 353e7d2b..4fae34b3 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain", "category"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{stablecoin_breakdown(["chain", "category"])}} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol.sql index 68195f6c..4ff1ce0c 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{stablecoin_breakdown(["symbol", "category"])}} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql index 1836627d..d324b3a2 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql @@ -1,2 +1,2 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain", "category", "symbol"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["chain", "category", "symbol"]) }} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql index 544ac13f..05ef576d 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["chain"]) }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_silver.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_silver.sql index c944fd4f..4f6c0cfb 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_silver.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_silver.sql @@ -1,23 +1,71 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key="unique_id", snowflake_warehouse="STABLECOIN_V2_LG") }} with daily_data as ( - {{ - dbt_utils.union_relations( - relations=[ - ref("ez_base_stablecoin_metrics_by_address"), - ref("ez_arbitrum_stablecoin_metrics_by_address"), - ref("ez_optimism_stablecoin_metrics_by_address"), - ref("ez_avalanche_stablecoin_metrics_by_address"), - ref("ez_polygon_stablecoin_metrics_by_address"), - ref("ez_ethereum_stablecoin_metrics_by_address"), - ref("ez_solana_stablecoin_metrics_by_address"), - ref("ez_tron_stablecoin_metrics_by_address"), - ref("ez_bsc_stablecoin_metrics_by_address"), - ref("ez_ton_stablecoin_metrics_by_address"), - ref("ez_celo_stablecoin_metrics_by_address"), - ] - ) - }} + select * + from {{ref("ez_base_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_arbitrum_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_optimism_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_avalanche_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_polygon_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_ethereum_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_solana_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_tron_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_bsc_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_ton_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} + union all + select * + from {{ref("ez_celo_stablecoin_metrics_by_address")}} + {% if is_incremental() %} + where date >= (select dateadd('day', -7, max(date)) from {{ this }}) + {% endif %} ) select date diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql index 4c892b40..46374263 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["symbol"]) }} diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql index 4a9473fa..111901ba 100644 --- a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "chain"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["symbol", "chain"]) }} diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category.sql index b15aeaff..1726b026 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "category"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["category"], 'month') }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_chain.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_chain.sql index 71b4d4d2..1e02eea1 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{stablecoin_breakdown(["chain", "category"], "month")}} diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol.sql index e43dcc93..d92705b0 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{stablecoin_breakdown(["symbol", "category"], "month")}} diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol_chain.sql index 20b0713f..c06fac11 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_category_symbol_chain.sql @@ -1,4 +1,4 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "chain", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["chain", "category", "symbol"], "month") }} diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_chain.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_chain.sql index d6449eb9..22d4cc03 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["chain"], "month") }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol.sql index e47a966e..952ecd0e 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["symbol"], "month") }} diff --git a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol_chain.sql index a055836a..4627b3ad 100644 --- a/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_monthly_stablecoin_breakdown_symbol_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "chain"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["symbol", "chain"], "month") }} diff --git a/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_chain.sql b/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_chain.sql index 042b774d..f328e4a8 100644 --- a/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_chain.sql @@ -3,7 +3,7 @@ with max_date as ( select max(date) as date - from {{ ref("agg_daily_stablecoin_breakdown") }} + from {{ ref("agg_daily_stablecoin_breakdown_silver") }} ) select @@ -12,6 +12,6 @@ select , sum(stablecoin_daily_txns) as stablecoin_daily_txns , count(distinct case when stablecoin_transfer_volume > 0 then from_address end) as stablecoin_dau , sum(case when date = (select date from max_date) then stablecoin_supply end) as stablecoin_supply -from {{ ref("agg_daily_stablecoin_breakdown") }} +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} where date >= dateadd(day, -31, to_date(sysdate())) group by chain \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_symbol.sql index 82a32735..ed1e5a36 100644 --- a/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_stablecoin_tiles_breakdown_symbol.sql @@ -3,7 +3,7 @@ with max_date as ( select max(date) as date - from {{ ref("agg_daily_stablecoin_breakdown") }} + from {{ ref("agg_daily_stablecoin_breakdown_silver") }} ) select @@ -12,6 +12,6 @@ select , sum(stablecoin_daily_txns) as stablecoin_daily_txns , count(distinct case when stablecoin_transfer_volume > 0 then from_address end) as stablecoin_dau , sum(case when date = (select date from max_date) then stablecoin_supply end) as stablecoin_supply -from {{ ref("agg_daily_stablecoin_breakdown") }} +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} where date >= dateadd(day, -31, to_date(sysdate())) group by symbol \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category.sql index f7b2583f..ba80eace 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "category"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["category"], 'week') }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_chain.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_chain.sql index 5c6c87c8..8e945749 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity" "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{stablecoin_breakdown(["chain", "category"], "week")}} diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol.sql index 2f48e83c..10436163 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "category"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{stablecoin_breakdown(["symbol", "category"], "week")}} diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol_chain.sql index 67145e94..8faa95de 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_category_symbol_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "category", "chain"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["chain", "category", "symbol"], "week") }} diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_chain.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_chain.sql index 81d744a7..0c78dd48 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "chain"], snowflake_warehouse="STABLECOIN_V2_LG") }} {{ stablecoin_breakdown(["chain"], "week") }} \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol.sql index 9bc959eb..795e76c2 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["symbol"], "week") }} diff --git a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol_chain.sql index 5739fcc0..057396fa 100644 --- a/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol_chain.sql +++ b/models/metrics/stablecoins/breakdowns/agg_weekly_stablecoin_breakdown_symbol_chain.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +{{ config(materialized="incremental", unique_key=["date_granularity", "symbol", "chain"], snowflake_warehouse="STABLECOIN_V2_LG_2") }} {{ stablecoin_breakdown(["symbol", "chain"], "week") }}