Skip to content

Commit

Permalink
Updating wrapped models (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebMelendez01 authored Dec 19, 2024
1 parent 0513852 commit c69336a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 34 deletions.
18 changes: 9 additions & 9 deletions models/artemis_wrapped/dim_artemis_wrapped.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ 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 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)
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)
)

select
Expand All @@ -54,5 +54,5 @@ select
, 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')}}
left join categories using (address)
from {{ref('agg_artemis_wrapped_metrics')}} wrapped
left join categories on lower(wrapped.address) = lower(categories.address)
14 changes: 13 additions & 1 deletion models/artemis_wrapped/metrics/agg_artemis_wrapped_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ select
, days_onchain_percent_rank
, apps_used
, apps_used_percent_rank
from {{ ref('agg_base_artemis_wrapped_metrics') }}
from {{ ref('agg_base_artemis_wrapped_metrics_with_percent') }}
union all
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_solana_artemis_wrapped_metrics_with_percent') }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
SELECT
address,
total_txns,
(SELECT COUNT(*) * 1.0 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.total_txns > outer_data.total_txns) AS total_txns_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.total_gas_paid > outer_data.total_gas_paid) AS total_gas_paid_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.days_onchain > outer_data.days_onchain) AS days_onchain_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.apps_used > outer_data.apps_used) AS apps_used_percent_rank
(
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@
SELECT
address,
total_txns,
(SELECT COUNT(*) * 1.0 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.total_txns > outer_data.total_txns) AS total_txns_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.total_gas_paid > outer_data.total_gas_paid) AS total_gas_paid_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.days_onchain > outer_data.days_onchain) AS days_onchain_percent_rank,
(
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 / (SELECT COUNT(*) FROM agg_data)
FROM agg_data AS inner_data
WHERE inner_data.apps_used > outer_data.apps_used) AS apps_used_percent_rank
(
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

0 comments on commit c69336a

Please sign in to comment.