-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: power user metric * chore: add metric to consolidate model * fix: linting in new metric * chore: update rf4 metrics blog post
- Loading branch information
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
warehouse/dbt/models/marts/superchain/metrics/rf4_power_user_addresses.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
with txns as ( | ||
select | ||
project_id, | ||
from_artifact_name, | ||
bucket_day, | ||
amount | ||
from {{ ref('rf4_events_daily_to_project') }} | ||
where | ||
event_type = 'CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT' | ||
and bucket_day >= '2023-10-01' | ||
), | ||
|
||
address_stats as ( | ||
select | ||
from_artifact_name, | ||
COUNT(distinct bucket_day) as days_count, | ||
COUNT(distinct project_id) as project_count, | ||
SUM(amount) as txns_count | ||
from txns | ||
group by | ||
from_artifact_name | ||
), | ||
|
||
power_users as ( | ||
select from_artifact_name | ||
from address_stats | ||
where | ||
days_count >= 30 | ||
and project_count >= 10 | ||
and txns_count >= 100 | ||
) | ||
|
||
select | ||
txns.project_id, | ||
'power_user_addresses' as metric, | ||
COUNT(distinct txns.from_artifact_name) as amount | ||
from txns | ||
left join power_users | ||
on txns.from_artifact_name = power_users.from_artifact_name | ||
where | ||
power_users.from_artifact_name is not null | ||
group by | ||
txns.project_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters