mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 13:56:44 +00:00
Merge pull request #19 from MetricsDAO/hotfix-2
This commit is contained in:
commit
5e5844553b
@ -1,7 +1,7 @@
|
||||
{{
|
||||
config(
|
||||
materialized = 'incremental',
|
||||
unique_key = 'tx_hash',
|
||||
unique_key = 'tx_id',
|
||||
tags = ['core'],
|
||||
cluster_by = ['block_timestamp']
|
||||
)
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
{{ config(materialized='table', tags=['metrics']) }}
|
||||
|
||||
-- WIP - example of creating metrics table/construct
|
||||
|
||||
SELECT
|
||||
date_trunc('day', block_timestamp) as metric_date,
|
||||
'daily' as metric_period,
|
||||
count(distinct miner) as miner_count
|
||||
FROM {{ ref("blocks") }}
|
||||
GROUP BY 1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
date_trunc('hour', block_timestamp) as metric_date,
|
||||
'hourly' as metric_period,
|
||||
count(distinct miner) as miner_count
|
||||
FROM {{ ref("blocks") }}
|
||||
GROUP BY 1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
date_trunc('minute', block_timestamp) as metric_date,
|
||||
'minute' as metric_period,
|
||||
count(distinct miner) as miner_count
|
||||
FROM {{ ref("blocks") }}
|
||||
GROUP BY 1
|
||||
@ -1,18 +0,0 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: metric_miner_count
|
||||
description: "The distinct number of miners within a given period"
|
||||
columns:
|
||||
- name: metric_date
|
||||
description: The date the metric occurred
|
||||
tests:
|
||||
- not_null
|
||||
- name: metric_period
|
||||
description: i.e. Hourly, Daily, etc.
|
||||
tests:
|
||||
- not_null
|
||||
- name: miner_count
|
||||
description: The distinct count of miners active in that period.
|
||||
tests:
|
||||
- not_null
|
||||
Loading…
Reference in New Issue
Block a user