AN-2582/unique-key-tx-test (#29)

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

* added dbt-env to gitignore for SSO functionality

* added .env to .gitignore to match current file

* fixed typo
This commit is contained in:
drethereum 2023-01-03 14:06:56 -07:00 committed by GitHub
parent bbd134c7f7
commit b52f79a7eb
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,4 +14,5 @@ logs/
.history/
**/.DS_Store
.vscode/
dbt-env/
.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 (