Skip to content

Commit

Permalink
Add tests for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Sep 26, 2024
1 parent 3ee8ad5 commit e5bd46b
Show file tree
Hide file tree
Showing 16 changed files with 2,470 additions and 0 deletions.
67 changes: 67 additions & 0 deletions models/staging/stg_account_signers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: 2

models:
- name: stg_account_signers
tests:
- dbt_utils.recency:
datepart: day
field: cast(closed_at as timestamp)
interval: 2
config:
severity: '{{ "error" if target.name == "prod" else "warn" }}'
meta:
description: "Monitors the freshness of your table over time, as the expected time between data updates."
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- account_id
- signer
- ledger_sequence
- last_modified_ledger
meta:
description: "Tests the uniqueness combination of: account_id, signer, ledger_sequence and last_modified_ledger"
columns:
- name: account_id
description: '{{ doc("account_id") }}'
tests:
- not_null
- name: signer
description: '{{ doc("signer") }}'
tests:
- not_null
- name: weight
description: '{{ doc("weight") }}'
tests:
- not_null
- name: sponsor
description: '{{ doc("sponsor") }}'
tests:
- not_null
- name: last_modified_ledger
tests:
- not_null
- name: ledger_entry_change
tests:
- not_null
- name: deleted
description: '{{ doc("deleted") }}'
tests:
- not_null
- name: batch_id
description: '{{ doc("batch_id") }}'
tests:
- not_null
- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null
- name: closed_at
tests:
- not_null
- name: ledger_sequence
tests:
- not_null
- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null
- name: airflow_start_ts
122 changes: 122 additions & 0 deletions models/staging/stg_accounts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
version: 2

models:
- name: stg_accounts
tests:
- dbt_utils.recency:
datepart: day
field: cast(closed_at as timestamp)
interval: 2
config:
severity: '{{ "error" if target.name == "prod" else "warn" }}'
meta:
description: "Monitors the freshness of your table over time, as the expected time between data updates."
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- account_id
- sequence_number
- ledger_entry_change
- last_modified_ledger
meta:
description: "Tests the uniqueness combination of: account_id, signer and ledger_sequence."
columns:
- name: account_id
description: '{{ doc("account_id") }}'
tests:
- not_null
- 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
- name: num_subentries
description: '{{ doc("num_subentries") }}'
tests:
- not_null
- name: inflation_destination
description: '{{ doc("inflation_destination") }}'
tests:
- not_null
- name: flags
description: '{{ doc("flags_accounts_balances") }}'
tests:
- not_null
- name: home_domain
description: '{{ doc("home_domain") }}'
tests:
- not_null
- 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_modifed_ledger
description: '{{ doc("last_modified_ledger") }}'
tests:
- not_null
- name: ledger_entry_change
description: '{{ doc("ledger_entry_change") }}'
tests:
- not_null
- accepted_values:
values: [0, 1, 2]
quote: false
- name: deleted
description: '{{ doc("deleted") }}'
tests:
- not_null
- 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
- name: batch_id
description: '{{ doc("batch_id") }}'
tests:
- not_null
- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null
- name: closed_at
tests:
- not_null
- name: ledger_sequence
tests:
- not_null
- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null
- name: airflow_start_ts
123 changes: 123 additions & 0 deletions models/staging/stg_claimable_balances.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
version: 2

models:
- name: stg_claimable_balances
tests:
- dbt_utils.recency:
datepart: day
field: cast(closed_at as timestamp)
interval: 2
config:
severity: '{{ "error" if target.name == "prod" else "warn" }}'
meta:
description: "Monitors the freshness of your table over time, as the expected time between data updates."
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- balance_id
- ledger_entry_change
meta:
description: "Tests the uniqueness combination of: balance_id and ledger_entry_change."
columns:
- name: balance_id
description: '{{ doc("balance_id") }}'
tests:
- not_null

- name: claimants
description: '{{ doc("claimants") }}'

- name: claimants.destination
description: '{{ doc("claimants_destination") }}'

- name: claimants.predicate
description: '{{ doc("claimants_predicate") }}'

- name: claimants.predicate.unconditional
description: '{{ doc("claimants_predicate_unconditional") }}'

- name: claimants.predicate.abs_before
description: '{{ doc("claimants_predicate_abs_before") }}'

- name: claimants.predicate.rel_before
description: '{{ doc("claimants_predicate_rel_before") }}'

- name: claimants.predicate.abs_before_epoch
description: '{{ doc("claimants_predicate_abs_before_epoch") }}'

- name: asset_type
description: '{{ doc("asset_type") }}'
tests:
- not_null

- name: asset_code
description: '{{ doc("asset_code") }}'
tests:
- not_null

- name: asset_issuer
description: '{{ doc("asset_issuer") }}'
tests:
- not_null

- name: asset_id
description: '{{ doc("asset_id") }}'
tests:
- not_null

- name: asset_amount
description: '{{ doc("asset_amount") }}'
tests:
- not_null

- name: sponsor
description: '{{ doc("sponsor") }}'
tests:
- not_null

- name: flags
description: '{{ doc("flags_accounts_balances") }}'
tests:
- not_null

- name: last_modified_ledger
description: '{{ doc("last_modified_ledger") }}'
tests:
- not_null

- name: ledger_entry_change
description: '{{ doc("ledger_entry_change") }}'
tests:
- not_null
- accepted_values:
values: [0, 1, 2]
quote: false

- name: deleted
description: '{{ doc("deleted") }}'
tests:
- not_null

- name: batch_id
description: '{{ doc("batch_id") }}'
tests:
- not_null

- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null

- name: closed_at
tests:
- not_null

- name: ledger_sequence
tests:
- not_null

- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null

- name: airflow_start_ts
Loading

0 comments on commit e5bd46b

Please sign in to comment.