From 0dafbecc040b77056055eb86460b06869a3d3999 Mon Sep 17 00:00:00 2001 From: Mike Stepanovic Date: Thu, 3 Apr 2025 11:34:15 -0600 Subject: [PATCH] removed stats from this PR --- models/gold/stats/gold_stats.yml | 37 ---------- .../stats/stats__ez_core_metrics_hourly.sql | 45 ------------ models/silver/stats/silver_stats.yml | 73 ------------------- .../silver_stats__core_metrics_hourly.sql | 54 -------------- 4 files changed, 209 deletions(-) delete mode 100644 models/gold/stats/gold_stats.yml delete mode 100644 models/gold/stats/stats__ez_core_metrics_hourly.sql delete mode 100644 models/silver/stats/silver_stats.yml delete mode 100644 models/silver/stats/silver_stats__core_metrics_hourly.sql diff --git a/models/gold/stats/gold_stats.yml b/models/gold/stats/gold_stats.yml deleted file mode 100644 index 779f6e7..0000000 --- a/models/gold/stats/gold_stats.yml +++ /dev/null @@ -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") }}' \ No newline at end of file diff --git a/models/gold/stats/stats__ez_core_metrics_hourly.sql b/models/gold/stats/stats__ez_core_metrics_hourly.sql deleted file mode 100644 index 539ea44..0000000 --- a/models/gold/stats/stats__ez_core_metrics_hourly.sql +++ /dev/null @@ -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 %} \ No newline at end of file diff --git a/models/silver/stats/silver_stats.yml b/models/silver/stats/silver_stats.yml deleted file mode 100644 index 12763c0..0000000 --- a/models/silver/stats/silver_stats.yml +++ /dev/null @@ -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 diff --git a/models/silver/stats/silver_stats__core_metrics_hourly.sql b/models/silver/stats/silver_stats__core_metrics_hourly.sql deleted file mode 100644 index 0578f31..0000000 --- a/models/silver/stats/silver_stats__core_metrics_hourly.sql +++ /dev/null @@ -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 \ No newline at end of file