mirror of
https://github.com/FlipsideCrypto/movement-models.git
synced 2026-02-06 13:51:46 +00:00
removed stats from this PR
This commit is contained in:
parent
c10fe89016
commit
0dafbecc04
@ -1,37 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: stats__ez_core_metrics_hourly
|
||||
description: '{{ doc("ez_core_metrics_hourly_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP_HOUR
|
||||
description: '{{ doc("block_timestamp_hour") }}'
|
||||
- name: BLOCK_NUMBER_MIN
|
||||
description: '{{ doc("block_number_min") }}'
|
||||
- name: BLOCK_NUMBER_MAX
|
||||
description: '{{ doc("block_number_max") }}'
|
||||
- name: BLOCK_COUNT
|
||||
description: '{{ doc("block_count") }}'
|
||||
- name: TRANSACTION_COUNT
|
||||
description: '{{ doc("transaction_count") }}'
|
||||
- name: TRANSACTION_COUNT_SUCCESS
|
||||
description: '{{ doc("transaction_count_success") }}'
|
||||
- name: TRANSACTION_COUNT_FAILED
|
||||
description: '{{ doc("transaction_count_failed") }}'
|
||||
- name: UNIQUE_SENDER_COUNT
|
||||
description: '{{ doc("unique_sender_count") }}'
|
||||
- name: UNIQUE_PAYLOAD_FUNCTION_COUNT
|
||||
description: '{{ doc("unique_payload_function_count") }}'
|
||||
- name: TOTAL_FEES_NATIVE
|
||||
description: '{{ doc("total_fees_native") }}'
|
||||
- name: TOTAL_FEES_USD
|
||||
description: '{{ doc("total_fees_usd") }}'
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: EZ_CORE_METRICS_HOURLY_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
@ -1,45 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = "block_timestamp_hour",
|
||||
cluster_by = ['block_timestamp_hour::DATE'],
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STATS, METRICS, CORE, HOURLY',
|
||||
} } },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_timestamp_hour,
|
||||
block_number_min,
|
||||
block_number_max,
|
||||
block_count,
|
||||
transaction_count,
|
||||
transaction_count_success,
|
||||
transaction_count_failed,
|
||||
unique_sender_count,
|
||||
unique_payload_function_count,
|
||||
total_fees AS total_fees_native,
|
||||
ROUND(
|
||||
(total_fees / pow(
|
||||
10,
|
||||
8
|
||||
)) * p.price,
|
||||
2
|
||||
) AS total_fees_usd,
|
||||
core_metrics_hourly_id AS ez_core_metrics_hourly_id,
|
||||
s.inserted_timestamp AS inserted_timestamp,
|
||||
s.modified_timestamp AS modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver_stats__core_metrics_hourly') }}
|
||||
s
|
||||
LEFT JOIN {{ ref('price__ez_prices_hourly') }}
|
||||
p
|
||||
ON s.block_timestamp_hour = p.hour
|
||||
WHERE
|
||||
p.is_native
|
||||
{% if is_incremental() %}
|
||||
AND s.block_timestamp_hour >= (
|
||||
SELECT
|
||||
MAX(block_timestamp_hour)
|
||||
FROM {{ this }})
|
||||
{% endif %}
|
||||
@ -1,73 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver_stats__core_metrics_hourly
|
||||
config:
|
||||
contract:
|
||||
enforced: true
|
||||
tests:
|
||||
- dbt_utils.sequential_values:
|
||||
column_name: BLOCK_TIMESTAMP_HOUR
|
||||
interval: 1
|
||||
config:
|
||||
severity: error
|
||||
error_if: ">0"
|
||||
tags: ['test_recency']
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP_HOUR
|
||||
data_type: TIMESTAMP_NTZ
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: BLOCK_NUMBER_MIN
|
||||
data_type: FLOAT
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: BLOCK_NUMBER_MAX
|
||||
data_type: FLOAT
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: BLOCK_COUNT
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: TRANSACTION_COUNT
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: TRANSACTION_COUNT_SUCCESS
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: TRANSACTION_COUNT_FAILED
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: UNIQUE_SENDER_COUNT
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: UNIQUE_PAYLOAD_FUNCTION_COUNT
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: TOTAL_FEES
|
||||
data_type: NUMBER
|
||||
tests:
|
||||
- not_null:
|
||||
tags: ['test_quality']
|
||||
- name: CORE_METRICS_HOURLY_ID
|
||||
data_type: VARCHAR
|
||||
- name: INSERTED_TIMESTAMP
|
||||
data_type: TIMESTAMP_NTZ
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
data_type: TIMESTAMP_NTZ
|
||||
- name: _INVOCATION_ID
|
||||
data_type: VARCHAR
|
||||
@ -1,54 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STATS, METRICS, CORE, HOURLY',
|
||||
} } },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
DATE_TRUNC(
|
||||
'hour',
|
||||
block_timestamp
|
||||
) AS block_timestamp_hour,
|
||||
MIN(block_number) :: FLOAT AS block_number_min,
|
||||
MAX(block_number) :: FLOAT AS block_number_max,
|
||||
COUNT(
|
||||
DISTINCT block_number
|
||||
) AS block_count,
|
||||
COUNT(
|
||||
DISTINCT tx_hash
|
||||
) AS transaction_count,
|
||||
COUNT(
|
||||
DISTINCT CASE
|
||||
WHEN success THEN tx_hash
|
||||
END
|
||||
) AS transaction_count_success,
|
||||
COUNT(
|
||||
DISTINCT CASE
|
||||
WHEN NOT success THEN tx_hash
|
||||
END
|
||||
) AS transaction_count_failed,
|
||||
COUNT(
|
||||
DISTINCT sender
|
||||
) AS unique_sender_count,
|
||||
COUNT(
|
||||
DISTINCT payload_function
|
||||
) AS unique_payload_function_count,
|
||||
SUM(COALESCE(gas_unit_price,0) * gas_used) AS total_fees,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['block_timestamp_hour']
|
||||
) }} AS core_metrics_hourly_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
{{ ref('silver__transactions') }}
|
||||
WHERE
|
||||
block_timestamp_hour < DATE_TRUNC(
|
||||
'hour',
|
||||
CURRENT_TIMESTAMP
|
||||
)
|
||||
GROUP BY
|
||||
1
|
||||
Loading…
Reference in New Issue
Block a user