From 9ef2551418ad6610142dc38f88ef39b9b4ed1dc3 Mon Sep 17 00:00:00 2001 From: Jack Forgash Date: Sun, 25 Sep 2022 12:36:02 -0600 Subject: [PATCH] add tests --- dbt_project.yml | 1 + models/core/core__fact_blocks.yml | 20 ++++++++++++------- .../{silver_blocks.yml => silver__blocks.yml} | 19 +++++++----------- 3 files changed, 21 insertions(+), 19 deletions(-) rename models/silver/{silver_blocks.yml => silver__blocks.yml} (95%) diff --git a/dbt_project.yml b/dbt_project.yml index 9ebcf8d..9e7caec 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -41,6 +41,7 @@ tests: +severity: warn # default to warn for all tests core: +severity: error # but error if a core view is having issues + +store_failures: true # all tests vars: "dbt_date:time_zone": GMT diff --git a/models/core/core__fact_blocks.yml b/models/core/core__fact_blocks.yml index 6e71c73..0a1de7a 100644 --- a/models/core/core__fact_blocks.yml +++ b/models/core/core__fact_blocks.yml @@ -8,6 +8,9 @@ models: - dbt_utils.unique_combination_of_columns: combination_of_columns: - block_id + - sequence_gaps: + column_name: block_id + where: BLOCK_TIMESTAMP < CURRENT_DATE columns: - name: BLOCK_ID @@ -26,6 +29,9 @@ models: - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - TIMESTAMP_NTZ + - dbt_expectations.expect_row_values_to_have_recent_data: + datepart: day + interval: 1 - name: BLOCK_HASH description: "{{ doc('block_hash')}}" @@ -35,7 +41,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: CHAIN_ID description: "{{ doc('chain_id')}}" tests: @@ -80,7 +86,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: BLOCK_HEIGHT description: "{{ doc('block_height')}}" tests: @@ -88,7 +94,7 @@ models: - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - NUMBER - + - name: LAST_BLOCK_ID description: "{{ doc('last_block_id')}}" tests: @@ -98,7 +104,7 @@ models: - ARRAY - VARIANT - OBJECT - + - name: LAST_COMMIT description: "{{ doc('last_commit')}}" tests: @@ -115,7 +121,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: LAST_RESULTS_HASH description: "{{ doc('last_results_hash')}}" tests: @@ -124,7 +130,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: NEXT_VALIDATORS_HASH description: "{{ doc('next_validators_hash')}}" tests: @@ -150,4 +156,4 @@ models: - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - STRING - - VARCHAR \ No newline at end of file + - VARCHAR diff --git a/models/silver/silver_blocks.yml b/models/silver/silver__blocks.yml similarity index 95% rename from models/silver/silver_blocks.yml rename to models/silver/silver__blocks.yml index efa31b6..49d5020 100644 --- a/models/silver/silver_blocks.yml +++ b/models/silver/silver__blocks.yml @@ -26,7 +26,7 @@ models: - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - TIMESTAMP_NTZ - + - name: TX_COUNT description: "{{ doc('tx_count')}}" tests: @@ -43,7 +43,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: CHAIN_ID description: "{{ doc('chain_id')}}" tests: @@ -88,7 +88,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: BLOCK_HEIGHT description: "{{ doc('block_height')}}" tests: @@ -96,7 +96,7 @@ models: - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - NUMBER - + - name: LAST_BLOCK_ID description: "{{ doc('last_block_id')}}" tests: @@ -106,7 +106,7 @@ models: - ARRAY - VARIANT - OBJECT - + - name: LAST_COMMIT description: "{{ doc('last_commit')}}" tests: @@ -123,7 +123,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: LAST_RESULTS_HASH description: "{{ doc('last_results_hash')}}" tests: @@ -132,7 +132,7 @@ models: column_type_list: - STRING - VARCHAR - + - name: NEXT_VALIDATORS_HASH description: "{{ doc('next_validators_hash')}}" tests: @@ -162,11 +162,6 @@ models: - name: _INGESTED_AT description: "{{ doc('_ingested_at')}}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - name: _INSERTED_TIMESTAMP description: "{{ doc('_inserted_timestamp')}}"