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:
Jack Forgash 2022-12-01 16:57:51 -07:00 committed by GitHub
parent 6be5eea928
commit 458895896a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 39 deletions

View File

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

View File

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

View File

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