fix float, schedule

This commit is contained in:
WHYTEWYLL 2024-02-23 16:50:04 +01:00
parent a8028c44ab
commit 768833619d
4 changed files with 10 additions and 10 deletions

View File

@ -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**

View File

@ -1,6 +1,6 @@
{{ config (
materialized = 'view',
tags = ['scheduled']
tags = ['scheduled_non_core']
) }}

View File

@ -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 }}
)

View File

@ -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,