mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 13:06:59 +00:00
fix float, schedule
This commit is contained in:
parent
a8028c44ab
commit
768833619d
@ -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**
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{{ config (
|
||||
materialized = 'view',
|
||||
tags = ['scheduled']
|
||||
tags = ['scheduled_non_core']
|
||||
) }}
|
||||
|
||||
|
||||
|
||||
@ -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 }}
|
||||
)
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user