diff --git a/.github/workflows/dbt_test_full.yml b/.github/workflows/dbt_test_daily.yml similarity index 92% rename from .github/workflows/dbt_test_full.yml rename to .github/workflows/dbt_test_daily.yml index 82632bd..4083c1b 100644 --- a/.github/workflows/dbt_test_full.yml +++ b/.github/workflows/dbt_test_daily.yml @@ -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" \ No newline at end of file + dbt test -m "stellar_models,models/silver" "stellar_models,models/gold" --vars 'test_days_threshold: 3' \ No newline at end of file diff --git a/.github/workflows/dbt_test_monthly.yml b/.github/workflows/dbt_test_monthly.yml new file mode 100644 index 0000000..51fcfb4 --- /dev/null +++ b/.github/workflows/dbt_test_monthly.yml @@ -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' \ No newline at end of file diff --git a/.github/workflows/dbt_test_weekly.yml b/.github/workflows/dbt_test_weekly.yml new file mode 100644 index 0000000..44a5618 --- /dev/null +++ b/.github/workflows/dbt_test_weekly.yml @@ -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' \ No newline at end of file diff --git a/models/gold/core/core__dim_assets.yml b/models/gold/core/core__dim_assets.yml index af829e8..5fe3537 100644 --- a/models/gold/core/core__dim_assets.yml +++ b/models/gold/core/core__dim_assets.yml @@ -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) }} diff --git a/models/gold/core/core__fact_accounts.yml b/models/gold/core/core__fact_accounts.yml index 73db925..2d8ce7f 100644 --- a/models/gold/core/core__fact_accounts.yml +++ b/models/gold/core/core__fact_accounts.yml @@ -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 \ No newline at end of file + description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/core/core__fact_ledgers.yml b/models/gold/core/core__fact_ledgers.yml index fe1a85a..d204d39 100644 --- a/models/gold/core/core__fact_ledgers.yml +++ b/models/gold/core/core__fact_ledgers.yml @@ -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") }}' diff --git a/models/gold/core/core__fact_operations.yml b/models/gold/core/core__fact_operations.yml index 8df8a1b..1cca28a 100644 --- a/models/gold/core/core__fact_operations.yml +++ b/models/gold/core/core__fact_operations.yml @@ -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") }}' diff --git a/models/gold/core/core__fact_transactions.yml b/models/gold/core/core__fact_transactions.yml index a37a3de..75b095d 100644 --- a/models/gold/core/core__fact_transactions.yml +++ b/models/gold/core/core__fact_transactions.yml @@ -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") }}' diff --git a/models/gold/defi/defi__fact_liquidity_pools.yml b/models/gold/defi/defi__fact_liquidity_pools.yml index ad056ac..3b10b24 100644 --- a/models/gold/defi/defi__fact_liquidity_pools.yml +++ b/models/gold/defi/defi__fact_liquidity_pools.yml @@ -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") }}' \ No newline at end of file diff --git a/models/gold/defi/defi__fact_trades.yml b/models/gold/defi/defi__fact_trades.yml index 5c25d30..445f1c3 100644 --- a/models/gold/defi/defi__fact_trades.yml +++ b/models/gold/defi/defi__fact_trades.yml @@ -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") }}' diff --git a/models/gold/operations/core__ez_operations.yml b/models/gold/operations/core__ez_operations.yml index 800457c..e12f39d 100644 --- a/models/gold/operations/core__ez_operations.yml +++ b/models/gold/operations/core__ez_operations.yml @@ -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") }}' diff --git a/models/silver/silver__accounts.yml b/models/silver/silver__accounts.yml index 34b297d..5ddce31 100644 --- a/models/silver/silver__accounts.yml +++ b/models/silver/silver__accounts.yml @@ -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 diff --git a/models/silver/silver__assets.yml b/models/silver/silver__assets.yml index cf58251..75ad0ca 100644 --- a/models/silver/silver__assets.yml +++ b/models/silver/silver__assets.yml @@ -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 \ No newline at end of file diff --git a/models/silver/silver__liquidity_pools.yml b/models/silver/silver__liquidity_pools.yml index eabcfa3..1934c3f 100644 --- a/models/silver/silver__liquidity_pools.yml +++ b/models/silver/silver__liquidity_pools.yml @@ -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 \ No newline at end of file diff --git a/models/silver/silver__operations.yml b/models/silver/silver__operations.yml index c18fe7d..72e8b79 100644 --- a/models/silver/silver__operations.yml +++ b/models/silver/silver__operations.yml @@ -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 \ No newline at end of file diff --git a/models/silver/silver__trades.yml b/models/silver/silver__trades.yml index 766c104..e38d849 100644 --- a/models/silver/silver__trades.yml +++ b/models/silver/silver__trades.yml @@ -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 \ No newline at end of file diff --git a/models/silver/silver__transactions.yml b/models/silver/silver__transactions.yml index 3adc489..64417b7 100644 --- a/models/silver/silver__transactions.yml +++ b/models/silver/silver__transactions.yml @@ -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 \ No newline at end of file