mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 15:36:43 +00:00
Silver Events Column (#72)
* adjusted bad events table to hold 3 error types * typo * clean * main and tweak * del bad events table
This commit is contained in:
parent
6be5eea928
commit
458895896a
@ -1,29 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
cluster_by = ['_inserted_timestamp::date'],
|
||||
unique_key = "CONCAT_WS('-', tx_id, event_index)"
|
||||
) }}
|
||||
|
||||
WITH events AS (
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__events_final') }}
|
||||
WHERE
|
||||
event_data :: STRING = '{}'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
events
|
||||
@ -1,8 +0,0 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__bad_events
|
||||
description: Tracks erroneous events.
|
||||
tests:
|
||||
- dbt_expectations.expect_table_row_count_to_be_between:
|
||||
max_value: 1
|
||||
@ -29,6 +29,7 @@ events AS (
|
||||
block_timestamp,
|
||||
block_height,
|
||||
tx_succeeded,
|
||||
INDEX AS _index_from_flatten,
|
||||
COALESCE(
|
||||
VALUE :event_index,
|
||||
VALUE :eventIndex
|
||||
@ -70,8 +71,6 @@ events AS (
|
||||
LATERAL FLATTEN(
|
||||
input => transaction_result :events
|
||||
)
|
||||
WHERE
|
||||
VALUE :: STRING != 'null'
|
||||
),
|
||||
FINAL AS (
|
||||
SELECT
|
||||
@ -87,6 +86,8 @@ events AS (
|
||||
event_data_type AS _event_data_type,
|
||||
event_data_fields AS _event_data_fields,
|
||||
try_parse_payload AS _try_parse_payload,
|
||||
_event_data_type :fields AS _attribute_fields,
|
||||
_index_from_flatten,
|
||||
_ingested_at,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
|
||||
Loading…
Reference in New Issue
Block a user