updated recency within tests, added workflows with different lookback vars

This commit is contained in:
Mike Stepanovic 2025-02-12 13:57:10 -07:00
parent 8ab094b0c6
commit 72ac0e071b
17 changed files with 257 additions and 158 deletions

View File

@ -4,7 +4,7 @@ run-name: dbt_test_scheduled
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
- cron: '0 4 * * *'
env:
DBT_PROFILES_DIR: ./
@ -39,4 +39,4 @@ jobs:
dbt deps
- name: Run DBT Jobs
run: |
dbt test -m "stellar_models,models/silver" "stellar_models,models/gold"
dbt test -m "stellar_models,models/silver" "stellar_models,models/gold" --vars 'test_days_threshold: 3'

42
.github/workflows/dbt_test_monthly.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: dbt_test_scheduled
run-name: dbt_test_scheduled
on:
workflow_dispatch:
schedule:
- cron: '0 4 1 * *'
env:
DBT_PROFILES_DIR: ./
ACCOUNT: "${{ secrets.ACCOUNT }}"
ROLE: "${{ secrets.ROLE }}"
USER: "${{ secrets.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ secrets.REGION }}"
DATABASE: "${{ secrets.DATABASE }}"
WAREHOUSE: "${{ secrets.WAREHOUSE }}"
SCHEMA: "${{ secrets.SCHEMA }}"
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: workflow_prod
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10.x"
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
dbt deps
- name: Run DBT Jobs
run: |
dbt test -m "stellar_models,models/silver" "stellar_models,models/gold" --vars 'test_days_threshold: 30'

42
.github/workflows/dbt_test_weekly.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: dbt_test_scheduled
run-name: dbt_test_scheduled
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1'
env:
DBT_PROFILES_DIR: ./
ACCOUNT: "${{ secrets.ACCOUNT }}"
ROLE: "${{ secrets.ROLE }}"
USER: "${{ secrets.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ secrets.REGION }}"
DATABASE: "${{ secrets.DATABASE }}"
WAREHOUSE: "${{ secrets.WAREHOUSE }}"
SCHEMA: "${{ secrets.SCHEMA }}"
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: workflow_prod
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10.x"
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
dbt deps
- name: Run DBT Jobs
run: |
dbt test -m "stellar_models,models/silver" "stellar_models,models/gold" --vars 'test_days_threshold: 7'

View File

@ -9,28 +9,28 @@ models:
- ASSET_TYPE
- ASSET_CODE
- ASSET_ISSUER
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
columns:
- name: ASSET_ID
description: '{{ doc("asset_id") }}'
tests:
- not_null
- name: ASSET_TYPE
description: '{{ doc("asset_type") }}'
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- name: ASSET_CODE
description: '{{ doc("asset_code") }}'
tests:
- not_null:
where: asset_type != 'native'
where: asset_type != 'native' AND modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- name: ASSET_ISSUER
description: '{{ doc("asset_issuer") }}'
tests:
- not_null:
where: asset_type != 'native'
where: asset_type != 'native' AND modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- name: ID
description: 'Numeric hash of asset_id, asset_type, and asset_issuer for join operations'
@ -38,15 +38,19 @@ models:
- name: DIM_ASSETS_ID
description: '{{ doc("pk") }}'
tests:
- not_null
- unique
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- unique:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}

View File

@ -10,133 +10,109 @@ models:
- SEQUENCE_NUMBER
- LEDGER_ENTRY_CHANGE
- LAST_MODIFIED_LEDGER
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
columns:
- name: ACCOUNT_ID
description: "{{ doc('account_id') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BALANCE
description: '{{ doc("balance") }}'
tests:
- not_null
- name: BUYING_LIABILITIES
description: '{{ doc("buying_liabilities") }}'
tests:
- not_null
- name: SELLING_LIABILITIES
description: '{{ doc("selling_liabilities") }}'
tests:
- not_null
- name: SEQUENCE_NUMBER
description: '{{ doc("sequence_number") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: NUM_SUBENTRIES
description: '{{ doc("num_subentries") }}'
tests:
- not_null
- name: INFLATION_DESTINATION
description: '{{ doc("inflation_destination") }}'
- name: FLAGS
description: '{{ doc("flags") }}'
tests:
- not_null
- name: HOME_DOMAIN
description: '{{ doc("home_domain") }}'
- name: MASTER_WEIGHT
description: '{{ doc("master_weight") }}'
tests:
- not_null
- name: THRESHOLD_LOW
description: '{{ doc("threshold_low") }}'
tests:
- not_null
- name: THRESHOLD_MEDIUM
description: '{{ doc("threshold_medium") }}'
tests:
- not_null
- name: THRESHOLD_HIGH
description: '{{ doc("threshold_high") }}'
tests:
- not_null
- name: LAST_MODIFIED_LEDGER
description: '{{ doc("last_modified_ledger") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: LEDGER_ENTRY_CHANGE
description: '{{ doc("ledger_entry_change") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: DELETED
description: '{{ doc("deleted") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: SPONSOR
description: '{{ doc("sponsor") }}'
- name: NUM_SPONSORED
description: '{{ doc("num_sponsored") }}'
tests:
- not_null
- name: NUM_SPONSORING
description: '{{ doc("num_sponsoring") }}'
tests:
- not_null
- name: SEQUENCE_LEDGER
description: '{{ doc("sequence_ledger") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: SEQUENCE_TIME
description: '{{ doc("sequence_time") }}'
tests:
- not_null
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BLOCK_TIMESTAMP
description: '{{ doc("block_timestamp") }}'
tests:
- not_null
- name: LEDGER_SEQUENCE
description: '{{ doc("ledger_sequence") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: FACT_ACCOUNTS_ID
description: '{{ doc("pk") }}'
tests:
- unique
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
description: '{{ doc("modified_timestamp") }}'

View File

@ -8,8 +8,10 @@ models:
description: '{{ doc("sequence") }}'
tests:
- dbt_expectations.expect_column_to_exist
- not_null
- unique
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- unique:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: LEDGER_HASH
description: '{{ doc("ledger_hash") }}'
@ -26,7 +28,8 @@ models:
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BLOCK_TIMESTAMP
description: '{{ doc("block_timestamp") }}'
@ -87,13 +90,9 @@ models:
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
- name: _INVOCATION_ID
description: '{{ doc("invocation_id") }}'

View File

@ -12,16 +12,19 @@ models:
- LEDGER_SEQUENCE
- TYPE
- TYPE_STRING
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
columns:
- name: ID
description: '{{ doc("op_id") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BLOCK_TIMESTAMP
description: '{{ doc("block_timestamp") }}'
@ -260,7 +263,8 @@ models:
- name: SOURCE_ACCOUNT
description: '{{ doc("source_account") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: OP_SOURCE_ACCOUNT_MUXED
description: '{{ doc("op_source_account_muxed") }}'
@ -268,23 +272,27 @@ models:
- name: TRANSACTION_ID
description: '{{ doc("transaction_id") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TYPE
description: '{{ doc("type") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TYPE_STRING
description: '{{ doc("type_string") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: LEDGER_SEQUENCE
description: '{{ doc("ledger_sequence") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: OP_ACCOUNT_MUXED
description: '{{ doc("account_muxed") }}'

View File

@ -8,8 +8,10 @@ models:
- name: ID
description: Unique identifier for the transaction
tests:
- not_null
- unique
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- unique:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TRANSACTION_HASH
description: '{{ doc("transaction_hash") }}'
@ -17,12 +19,14 @@ models:
- name: LEDGER_SEQUENCE
description: '{{ doc("ledger_sequence") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BLOCK_TIMESTAMP
description: '{{ doc("block_timestamp") }}'
@ -30,7 +34,8 @@ models:
- name: ACCOUNT
description: '{{ doc("account") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: ACCOUNT_SEQUENCE
description: '{{ doc("account_sequence") }}'

View File

@ -9,7 +9,8 @@ models:
- name: LIQUIDITY_POOL_ID
description: '{{ doc("liquidity_pool_id") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TYPE
description: '{{ doc("type") }}'
@ -74,28 +75,20 @@ models:
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: LEDGER_SEQUENCE
description: '{{ doc("ledger_sequence") }}'
- name: FACT_LIQUIDITY_POOLS_ID
description: '{{ doc("pk") }}'
tests:
- unique
- not_null
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
- name: _INVOCATION_ID
description: '{{ doc("invocation_id") }}'
tests:
- not_null
description: '{{ doc("invocation_id") }}'

View File

@ -7,22 +7,26 @@ models:
- name: history_operation_id
description: '{{ doc("history_operation_id") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: trade_order
description: '{{ doc("order") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: ledger_closed_at
description: '{{ doc("closed_at") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: selling_account_address
description: '{{ doc("selling_account_address") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: selling_asset_code
description: '{{ doc("selling_asset_code") }}'
@ -33,22 +37,26 @@ models:
- name: selling_asset_type
description: '{{ doc("selling_asset_type") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: selling_asset_id
description: '{{ doc("selling_asset_id") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: selling_amount
description: '{{ doc("selling_amount") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: buying_account_address
description: '{{ doc("buying_account_address") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: buying_asset_code
description: '{{ doc("buying_asset_code") }}'
@ -59,27 +67,32 @@ models:
- name: buying_asset_type
description: '{{ doc("buying_asset_type") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: buying_asset_id
description: '{{ doc("buying_asset_id") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: buying_amount
description: '{{ doc("buying_amount") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: price_n
description: '{{ doc("price_n") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: price_d
description: '{{ doc("price_d") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: selling_offer_id
description: '{{ doc("selling_offer_id") }}'
@ -96,7 +109,8 @@ models:
- name: trade_type
description: '{{ doc("trade_type") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: rounding_slippage
description: '{{ doc("rounding_slippage") }}'
@ -107,23 +121,28 @@ models:
- name: fact_trades_id
description: '{{ doc("pk") }}'
tests:
- unique
- not_null
- unique:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: _inserted_timestamp
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: inserted_timestamp
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: modified_timestamp
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: _invocation_id
description: '{{ doc("invocation_id") }}'

View File

@ -8,10 +8,14 @@ models:
- name: OP_ID
description: '{{ doc("op_id") }}'
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: OP_SOURCE_ACCOUNT
description: '{{ doc("op_source_account") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: OP_SOURCE_ACCOUNT_MUXED
description: '{{ doc("op_source_account_muxed") }}'
@ -306,12 +310,21 @@ models:
- name: TX_ID
description: '{{ doc("transaction_id") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TYPE
description: '{{ doc("type") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TYPE_STRING
description: '{{ doc("type_string") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BATCH_ID
description: '{{ doc("batch_id") }}'
@ -357,6 +370,9 @@ models:
- name: CLOSED_AT
description: '{{ doc("closed_at") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: BLOCK_TIMESTAMP
description: '{{ doc("block_timestamp") }}'
@ -366,6 +382,9 @@ models:
- name: LEDGER_SEQUENCE
description: '{{ doc("ledger_sequence") }}'
tests:
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- name: TX_ACCOUNT
description: '{{ doc("tx_account") }}'

View File

@ -1,39 +1,37 @@
version: 2
models:
- name: silver__accounts
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ACCOUNT_ID
- SEQUENCE_NUMBER
- LEDGER_ENTRY_CHANGE
- LAST_MODIFIED_LEDGER
columns:
- name: ACCOUNT_ID
description: "{{ doc('account_id') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR
- name: SEQUENCE_NUMBER
description: "{{ doc('sequence_number') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: LEDGER_ENTRY_CHANGE
description: "{{ doc('ledger_entry_change') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: LAST_MODIFIED_LEDGER
description: "{{ doc('last_modified_ledger') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER

View File

@ -1,31 +1,29 @@
version: 2
models:
- name: silver__assets
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ASSET_TYPE
- ASSET_CODE
- ASSET_ISSUER
columns:
- name: ASSET_TYPE
description: "{{ doc('asset_type') }}"
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR
- name: ASSET_CODE
description: "{{ doc('asset_code') }}"
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR
- name: ASSET_ISSUER
description: "{{ doc('asset_issuer') }}"
tests:
- not_null
- not_null:
where: modified_timestamp > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR

View File

@ -1,31 +1,29 @@
version: 2
models:
- name: silver__liquidity_pools
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- LIQUIDITY_POOL_ID
- LEDGER_ENTRY_CHANGE
- LAST_MODIFIED_LEDGER
columns:
- name: LIQUIDITY_POOL_ID
description: "{{ doc('liquidity_pool_id') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR
- name: LEDGER_ENTRY_CHANGE
description: "{{ doc('ledger_entry_change') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: LAST_MODIFIED_LEDGER
description: "{{ doc('last_modified_ledger') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER

View File

@ -1,55 +1,53 @@
version: 2
models:
- name: silver__operations
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- ID
- SOURCE_ACCOUNT
- TRANSACTION_ID
- LEDGER_SEQUENCE
- TYPE
- TYPE_STRING
columns:
- name: ID
description: "{{ doc('id') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: SOURCE_ACCOUNT
description: "{{ doc('source_account') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR
- name: TRANSACTION_ID
description: "{{ doc('transaction_id') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: LEDGER_SEQUENCE
description: "{{ doc('ledger_sequence') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: TYPE
description: "{{ doc('type') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: TYPE_STRING
description: "{{ doc('type_string') }}"
tests:
- not_null
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- VARCHAR

View File

@ -1,23 +1,21 @@
version: 2
models:
- name: silver__trades
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- HISTORY_OPERATION_ID
- '"order"'
columns:
- name: HISTORY_OPERATION_ID
description: "{{ doc('history_operation_id') }}"
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER
- name: '"order"'
description: "{{ doc('order') }}"
tests:
- not_null
- not_null:
where: ledger_closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER

View File

@ -5,8 +5,10 @@ models:
- name: ID
description: "{{ doc('id') }}"
tests:
- not_null
- unique
- not_null:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- unique:
where: closed_at > current_date - {{ var('test_days_threshold', 3) }}
- dbt_expectations.expect_column_values_to_be_in_type_list:
column_type_list:
- NUMBER