From 0302ea551cd692719452d8b9f698339f689dd191 Mon Sep 17 00:00:00 2001 From: Sebastian Melendez Date: Thu, 19 Dec 2024 14:48:49 -0500 Subject: [PATCH] updating models --- .../artemis_wrapped/dim_artemis_wrapped.sql | 20 +++++-------- models/artemis_wrapped/dim_rugged_rat.sql | 2 +- .../dim_solana_trench_warrior.sql | 7 +++-- .../metrics/agg_artemis_wrapped_metrics.sql | 16 ++++------ ...e_artemis_wrapped_metrics_with_percent.sql | 29 ------------------- ...a_artemis_wrapped_metrics_with_percent.sql | 28 ------------------ 6 files changed, 18 insertions(+), 84 deletions(-) delete mode 100644 models/artemis_wrapped/metrics/agg_base_artemis_wrapped_metrics_with_percent.sql delete mode 100644 models/artemis_wrapped/metrics/agg_solana_artemis_wrapped_metrics_with_percent.sql diff --git a/models/artemis_wrapped/dim_artemis_wrapped.sql b/models/artemis_wrapped/dim_artemis_wrapped.sql index 50c8380b..2e06468a 100644 --- a/models/artemis_wrapped/dim_artemis_wrapped.sql +++ b/models/artemis_wrapped/dim_artemis_wrapped.sql @@ -33,26 +33,22 @@ categories as ( , ARRAY_TO_STRING(boomer.reason, ', ') ) as reason from {{ref('dim_blockbuster')}} block_buster - full outer join {{ref('dim_bob_the_builder')}} bob_the_builder on lower(block_buster.address) = lower(bob_the_builder.address) - full outer join {{ref('dim_botimus_prime')}} botimus_prime on lower(block_buster.address) = lower(botimus_prime.address) - full outer join {{ref('dim_terminally_based')}} terminally_based on lower(block_buster.address) = lower(terminally_based.address) - full outer join {{ref('dim_wolf_of_wallstreet')}} wolf_of_wallstreet on lower(block_buster.address) = lower(wolf_of_wallstreet.address) - full outer join {{ref('dim_dora_the_explorer')}} dora_the_explorer on lower(block_buster.address) = lower(dora_the_explorer.address) - full outer join {{ref('dim_old_mcdonald')}} old_mcdonald on lower(block_buster.address) = lower(old_mcdonald.address) - full outer join {{ref('dim_boomer')}} boomer on lower(block_buster.address) = lower(boomer.address) + full outer join {{ref('dim_bob_the_builder')}} bob_the_builder using(address) + full outer join {{ref('dim_botimus_prime')}} botimus_prime using(address) + full outer join {{ref('dim_terminally_based')}} terminally_based using(address) + full outer join {{ref('dim_wolf_of_wallstreet')}} wolf_of_wallstreet using(address) + full outer join {{ref('dim_dora_the_explorer')}} dora_the_explorer using(address) + full outer join {{ref('dim_old_mcdonald')}} old_mcdonald using(address) + full outer join {{ref('dim_boomer')}} boomer using(address) ) select - address + wrapped.address , coalesce(category, 'NORMIE') as category , reason , total_txns - , total_txns_percent_rank as total_txns_percent_rank , total_gas_paid - , total_gas_paid_percent_rank as total_gas_paid_percent_rank , days_onchain - , days_onchain_percent_rank as days_onchain_percent_rank , apps_used - , apps_used_percent_rank as apps_used_percent_rank from {{ref('agg_artemis_wrapped_metrics')}} wrapped left join categories on lower(wrapped.address) = lower(categories.address) \ No newline at end of file diff --git a/models/artemis_wrapped/dim_rugged_rat.sql b/models/artemis_wrapped/dim_rugged_rat.sql index 44407472..d1fd7d66 100644 --- a/models/artemis_wrapped/dim_rugged_rat.sql +++ b/models/artemis_wrapped/dim_rugged_rat.sql @@ -1,6 +1,6 @@ {{config(materialized='table')}} -select lower(address) as address, 'WOLF_OF_WALL_STREET' as category, array_agg(distinct symbol) as reason +select lower(address) as address, 'RUGGED_RAT' as category, array_agg(distinct symbol) as reason from {{ ref('agg_solana_tokens_held') }} where (symbol = 'HAWKTUAH' and first_seen <= '2024-11-26') diff --git a/models/artemis_wrapped/dim_solana_trench_warrior.sql b/models/artemis_wrapped/dim_solana_trench_warrior.sql index 61a0c708..19924061 100644 --- a/models/artemis_wrapped/dim_solana_trench_warrior.sql +++ b/models/artemis_wrapped/dim_solana_trench_warrior.sql @@ -1,7 +1,8 @@ {{config(materialized='table')}} -select lower(address) as address, 'SOLANA_TRENCH_WARRIOR' as category, array_agg(app) as reason +select lower(address) as address, 'SOLANA_TRENCH_WARRIOR' as category, sum(interactions) as reason from {{ ref('agg_solana_app_interactions') }} -where interactions > 300 and app in ('pumpdotfun', 'raydium') -group by 1 \ No newline at end of file +where app in ('pumpdotfun', 'raydium') +group by 1 +having reason > 300 \ No newline at end of file diff --git a/models/artemis_wrapped/metrics/agg_artemis_wrapped_metrics.sql b/models/artemis_wrapped/metrics/agg_artemis_wrapped_metrics.sql index d3fe0382..2693b13b 100644 --- a/models/artemis_wrapped/metrics/agg_artemis_wrapped_metrics.sql +++ b/models/artemis_wrapped/metrics/agg_artemis_wrapped_metrics.sql @@ -3,23 +3,17 @@ select address , total_txns - , total_txns_percent_rank , total_gas_paid - , total_gas_paid_percent_rank , days_onchain - , days_onchain_percent_rank , apps_used - , apps_used_percent_rank -from {{ ref('agg_base_artemis_wrapped_metrics_with_percent') }} +from {{ ref('agg_base_artemis_wrapped_metrics') }} + union all + select - address + address::string as address , total_txns - , total_txns_percent_rank , total_gas_paid - , total_gas_paid_percent_rank , days_onchain - , days_onchain_percent_rank , apps_used - , apps_used_percent_rank -from {{ ref('agg_solana_artemis_wrapped_metrics_with_percent') }} \ No newline at end of file +from {{ ref('agg_solana_artemis_wrapped_metrics') }} \ No newline at end of file diff --git a/models/artemis_wrapped/metrics/agg_base_artemis_wrapped_metrics_with_percent.sql b/models/artemis_wrapped/metrics/agg_base_artemis_wrapped_metrics_with_percent.sql deleted file mode 100644 index e8435c2d..00000000 --- a/models/artemis_wrapped/metrics/agg_base_artemis_wrapped_metrics_with_percent.sql +++ /dev/null @@ -1,29 +0,0 @@ -{{config(materialized='table', snowflake_warehouse='BALANCES_LG')}} - -SELECT - address, - total_txns, - ( - SELECT COUNT(*) * 1.0 / 97059729.0 - FROM {{ref('agg_base_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.total_txns > outer_data.total_txns - ) AS total_txns_percent_rank, - total_gas_paid, - ( - SELECT COUNT(*) * 1.0 / 97059729.0 - FROM {{ref('agg_base_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.total_gas_paid > outer_data.total_gas_paid - ) AS total_gas_paid_percent_rank, - days_onchain, - ( - SELECT COUNT(*) * 1.0 / 97059729.0 - FROM {{ref('agg_base_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.days_onchain > outer_data.days_onchain - ) AS days_onchain_percent_rank, - apps_used, - ( - SELECT COUNT(*) * 1.0 / 97059729.0 - FROM {{ref('agg_base_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.apps_used > outer_data.apps_used - ) AS apps_used_percent_rank -FROM {{ref('agg_base_artemis_wrapped_metrics')}} AS outer_data \ No newline at end of file diff --git a/models/artemis_wrapped/metrics/agg_solana_artemis_wrapped_metrics_with_percent.sql b/models/artemis_wrapped/metrics/agg_solana_artemis_wrapped_metrics_with_percent.sql deleted file mode 100644 index 4d2079f5..00000000 --- a/models/artemis_wrapped/metrics/agg_solana_artemis_wrapped_metrics_with_percent.sql +++ /dev/null @@ -1,28 +0,0 @@ -{{config(materialized='table', snowflake_warehouse='BALANCES_LG')}} -SELECT - address, - total_txns, - ( - SELECT COUNT(*) * 1.0 / 660782282.0 - FROM {{ref('agg_solana_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.total_txns > outer_data.total_txns - ) AS total_txns_percent_rank, - total_gas_paid, - ( - SELECT COUNT(*) * 1.0 / 660782282.0 - FROM {{ref('agg_solana_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.total_gas_paid > outer_data.total_gas_paid - ) AS total_gas_paid_percent_rank, - days_onchain, - ( - SELECT COUNT(*) * 1.0 / 660782282.0 - FROM {{ref('agg_solana_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.days_onchain > outer_data.days_onchain - ) AS days_onchain_percent_rank, - apps_used, - ( - SELECT COUNT(*) * 1.0 / 660782282.0 - FROM {{ref('agg_solana_artemis_wrapped_metrics')}} AS inner_data - WHERE inner_data.apps_used > outer_data.apps_used - ) AS apps_used_percent_rank -FROM {{ref("agg_solana_artemis_wrapped_metrics")}} AS outer_data