diff --git a/models/descriptions/__overview__.md b/models/descriptions/__overview__.md index 60afc1e..16457ad 100644 --- a/models/descriptions/__overview__.md +++ b/models/descriptions/__overview__.md @@ -56,7 +56,7 @@ There is more information on how to use dbt docs in the last section of this doc ### Stats Tables (flow.stats) -- [ez_core_metrics_hourly](https://flipsidecrypto.github.io/flow-models/#!/model/model.flow_models.stats__ez_core_metrics_hourly) +- [ez_core_metrics_hourly](#!/model/model.flow_models.stats__ez_core_metrics_hourly) ## **Data Model Overview** diff --git a/models/gold/stats/stats__ez_core_metrics_hourly.sql b/models/gold/stats/stats__ez_core_metrics_hourly.sql index 80bcff9..dd20bed 100644 --- a/models/gold/stats/stats__ez_core_metrics_hourly.sql +++ b/models/gold/stats/stats__ez_core_metrics_hourly.sql @@ -1,6 +1,6 @@ {{ config ( materialized = 'view', - tags = ['scheduled'] + tags = ['scheduled_non_core'] ) }} diff --git a/models/silver/stats/silver_stats__core_metrics_block_hourly.sql b/models/silver/stats/silver_stats__core_metrics_block_hourly.sql index e409293..e745b23 100644 --- a/models/silver/stats/silver_stats__core_metrics_block_hourly.sql +++ b/models/silver/stats/silver_stats__core_metrics_block_hourly.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_timestamp_hour", cluster_by = ['block_timestamp_hour::DATE'], - tags = ['curated'] + tags = ['curated', 'scheduled_non_core'] ) }} SELECT @@ -11,8 +11,8 @@ SELECT 'hour', block_timestamp ) AS block_timestamp_hour, - MIN(block_height) AS block_number_min, - MAX(block_height) AS block_number_max, + MIN(block_height) :: INT AS block_number_min, + MAX(block_height) :: INT AS block_number_max, COUNT( 1 ) AS block_count, @@ -31,10 +31,10 @@ WHERE {% if is_incremental() %} AND DATE_TRUNC( 'hour', - _inserted_timestamp + inserted_timestamp ) >= ( SELECT - MAX(DATE_TRUNC('hour', _inserted_timestamp)) - INTERVAL '12 hours' + MAX(DATE_TRUNC('hour', inserted_timestamp)) - INTERVAL '12 hours' FROM {{ this }} ) diff --git a/models/silver/stats/silver_stats__core_metrics_hourly.sql b/models/silver/stats/silver_stats__core_metrics_hourly.sql index c4759d9..f488c2e 100644 --- a/models/silver/stats/silver_stats__core_metrics_hourly.sql +++ b/models/silver/stats/silver_stats__core_metrics_hourly.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_timestamp_hour", cluster_by = ['block_timestamp_hour::DATE'], - tags = ['curated'] + tags = ['curated', 'scheduled_non_core'] ) }} WITH fees AS ( @@ -12,7 +12,7 @@ WITH fees AS ( 'hour', block_timestamp ) AS block_timestamp_hour, - SUM(event_data:amount):: DECIMAL as total_fees + SUM(event_data:amount :: FLOAT ) as total_fees FROM {{ ref('core__fact_events') }} -- TODO: change this to silver when the backfill is done WHERE @@ -85,7 +85,7 @@ transactions AS ( ) SELECT tx.*, - COALESCE(total_fees, 0) ::DECIMAL AS total_fees, -- As we are missing data, we miss the fee events. We need to coalesce to 0 + COALESCE(total_fees, 0) AS total_fees, -- As we are missing data, we miss the fee events. We need to coalesce to 0 {{ dbt_utils.generate_surrogate_key( ['tx.block_timestamp_hour'] ) }} AS core_metrics_hourly_id,