AN-2584/unique-key-tx-test (#22)

* changed unique keys on log and traces and added new test to log

* added dbt-env to gitignore for SSO functionality
This commit is contained in:
drethereum 2023-01-03 14:07:21 -07:00 committed by GitHub
parent c365d80fff
commit 5f33cb7dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 4 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ logs/
.history/
**/.DS_Store
.vscode/
dbt-env/

View File

@ -0,0 +1,14 @@
{% test tx_block_count(
model,
column_name
) %}
SELECT
{{ column_name }},
COUNT(DISTINCT block_number) AS num_blocks
FROM
{{ model }}
GROUP BY {{ column_name }}
HAVING num_blocks > 1
{% endtest %}

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = "_log_id",
cluster_by = ['block_timestamp::DATE']
unique_key = 'tx_hash',
cluster_by = ['block_timestamp::DATE'],
incremental_strategy = 'delete+insert'
) }}
WITH base_txs AS (

View File

@ -32,6 +32,10 @@ models:
- not_null
- dbt_expectations.expect_column_values_to_match_regex:
regex: 0[xX][0-9a-fA-F]+
- tx_block_count:
config:
severity: error
error_if: "!=0"
- name: EVENT_INDEX
tests:
- not_null

View File

@ -1,7 +1,8 @@
{{ config(
materialized = 'incremental',
unique_key = '_call_id',
cluster_by = ['block_timestamp::DATE']
unique_key = 'tx_hash',
cluster_by = ['block_timestamp::DATE'],
incremental_strategy = 'delete+insert'
) }}
WITH new_blocks AS (