AN-2580/unique-key-tx-test (#35)

* changed unique key in logs and traces and added new test to logs

* remove user file

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

3
.gitignore vendored
View File

@ -14,4 +14,5 @@ logs/
.history/
**/.DS_Store
.vscode/
.env
.env
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 = ['_inserted_timestamp::DATE']
unique_key = 'tx_hash',
cluster_by = ['_inserted_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 = ['_inserted_timestamp::DATE']
unique_key = 'tx_hash',
cluster_by = ['_inserted_timestamp::DATE'],
incremental_strategy = 'delete+insert'
) }}
WITH new_blocks AS (