From ca47b24e6d2d88c829d846cc8fc2d25e4b536d42 Mon Sep 17 00:00:00 2001 From: Raymond Cheng Date: Tue, 30 Apr 2024 14:16:44 -0700 Subject: [PATCH] fix: onchain_metrics renaming (#1333) * Add `_v1` to the model name * Update names to be more consistent --- ...l => onchain_metrics_by_collection_v1.sql} | 34 ++++++++++--------- ....sql => onchain_metrics_by_project_v1.sql} | 26 +++++++------- 2 files changed, 31 insertions(+), 29 deletions(-) rename warehouse/dbt/models/marts/onchain_metrics/{onchain_metrics_by_collection.sql => onchain_metrics_by_collection_v1.sql} (88%) rename warehouse/dbt/models/marts/onchain_metrics/{onchain_metrics_by_project.sql => onchain_metrics_by_project_v1.sql} (89%) diff --git a/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection.sql b/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection_v1.sql similarity index 88% rename from warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection.sql rename to warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection_v1.sql index acd6bba0b..c9488551a 100644 --- a/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection.sql +++ b/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_collection_v1.sql @@ -162,8 +162,9 @@ contracts AS ( collection_by_network AS ( SELECT c.collection_id, - ctx.onchain_network, - c.collection_name + c.collection_slug, + c.collection_name, + ctx.onchain_network FROM {{ ref('collections') }} AS c INNER JOIN contracts AS ctx ON c.collection_id = ctx.collection_id @@ -172,25 +173,26 @@ collection_by_network AS ( -- Final query to join all the metrics together for collections SELECT c.collection_id, - c.onchain_network AS network, + c.collection_slug, c.collection_name, - co.num_contracts, - ma.total_projects, - ma.first_txn_date, - ma.total_txns, + c.onchain_network AS `artifact_namespace`, + ma.total_projects AS `total_project_count`, + co.num_contracts AS `total_contract_count`, + ma.first_txn_date AS `first_transaction_date`, + ma.total_txns AS `total_transaction_count`, + m6.txns_6_months AS `transaction_count_6_months`, ma.total_l2_gas, - ma.total_users, - m6.txns_6_months, m6.l2_gas_6_months, - m6.users_6_months, - nu.new_user_count AS new_users, - us.high_frequency_users, - us.more_active_users, - us.less_active_users, - us.multi_project_users, + ma.total_users AS `total_user_address_count`, + m6.users_6_months AS `user_address_count_6_months`, + nu.new_user_count AS `new_user_count_3_months`, + us.high_frequency_users AS `high_frequency_address_count`, + us.more_active_users AS `more_active_user_address_count`, + us.less_active_users AS `less_active_user_address_count`, + us.multi_project_users AS `multi_project_user_address_count`, ( us.high_frequency_users + us.more_active_users + us.less_active_users - ) AS active_users + ) AS `total_active_user_address_count` FROM collection_by_network AS c INNER JOIN metrics_all_time AS ma ON diff --git a/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project.sql b/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project_v1.sql similarity index 89% rename from warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project.sql rename to warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project_v1.sql index 2e24e9835..aa1c5e62b 100644 --- a/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project.sql +++ b/warehouse/dbt/models/marts/onchain_metrics/onchain_metrics_by_project_v1.sql @@ -166,25 +166,25 @@ project_by_network AS ( SELECT p.project_id, p.project_slug, - p.onchain_network AS network, p.project_name, + p.onchain_network AS `artifact_namespace`, -- TODO: add deployers owned by project - c.num_contracts, - ma.first_txn_date, - ma.total_txns, + c.num_contracts AS `total_contract_count`, + ma.first_txn_date AS `first_transaction_date`, + ma.total_txns AS `total_transaction_count`, + m6.txns_6_months AS `transaction_count_6_months`, ma.total_l2_gas, - ma.total_users, - m6.txns_6_months, m6.l2_gas_6_months, - m6.users_6_months, - nu.new_user_count, - us.high_frequency_users, - us.more_active_users, - us.less_active_users, - us.multi_project_users, + ma.total_users AS `total_user_address_count`, + m6.users_6_months AS `user_address_count_6_months`, + nu.new_user_count AS `new_user_count_3_months`, + us.high_frequency_users AS `high_frequency_address_count`, + us.more_active_users AS `more_active_user_address_count`, + us.less_active_users AS `less_active_user_address_count`, + us.multi_project_users AS `multi_project_user_address_count`, ( us.high_frequency_users + us.more_active_users + us.less_active_users - ) AS active_users + ) AS `total_active_user_address_count` FROM project_by_network AS p LEFT JOIN metrics_all_time AS ma ON