Skip to content

Commit

Permalink
Merge pull request #20 from stellar/fix-test-errors
Browse files Browse the repository at this point in the history
Fix test errors in source tables
  • Loading branch information
chowbao authored Feb 15, 2024
2 parents b7287db + ea0d97d commit 24a7213
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 73 deletions.
6 changes: 3 additions & 3 deletions models/sources/src_config_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: closed_at
field: cast(closed_at as datetime)
interval: 12
config:
severity: warn
Expand All @@ -22,8 +22,8 @@ sources:
- last_modified_ledger
- ledger_entry_change
config:
where: closed_at >= datetime_trunc(datetime_sub(current_timestamp(), interval 2 day), day)
and closed_at < datetime_trunc(current_timestamp(), day)
where: closed_at >= timestamp_trunc(timestamp_sub(current_timestamp(), interval 2 day), day)
and closed_at < timestamp_trunc(current_timestamp(), day)
meta:
description:
"Tests the uniqueness combination of: config_setting_id, last_modified_ledger, and ledger_entry_change."
Expand Down
6 changes: 3 additions & 3 deletions models/sources/src_contract_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: closed_at
field: cast(closed_at as datetime)
interval: 12
config:
severity: warn
Expand All @@ -23,8 +23,8 @@ sources:
- last_modified_ledger
- ledger_entry_change
config:
where: closed_at >= datetime_trunc(datetime_sub(current_timestamp(), interval 2 day), day)
and closed_at < datetime_trunc(current_timestamp(), day)
where: closed_at >= timestamp_trunc(timestamp_sub(current_timestamp(), interval 2 day), day)
and closed_at < timestamp_trunc(current_timestamp(), day)
meta:
description:
"Tests the uniqueness combination of: contract_code_hash, contract_code_ext_v, last_modified_ledger, and ledger_entry_change."
Expand Down
15 changes: 1 addition & 14 deletions models/sources/src_contract_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,13 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: closed_at
field: cast(closed_at as datetime)
interval: 12
config:
severity: 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:
- contract_id
- contract_key_type
- contract_durability
- last_modified_ledger
- ledger_entry_change
config:
where: closed_at >= datetime_trunc(datetime_sub(current_timestamp(), interval 2 day), day)
and closed_at < datetime_trunc(current_timestamp(), day)
meta:
description:
"Tests the uniqueness combination of: contract_id, contract_key_type, contract_durability, last_modified_ledger, and ledger_entry_change."
columns:
- name: contract_id
description: '{{ doc("contract_id") }}'
Expand Down
2 changes: 1 addition & 1 deletion models/sources/src_history_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sources:
"Monitors the freshness of your table over time, as the expected time between data updates."
columns:
- name: assets_id
description: '{{ doc("asset_type") }}'
description: '{{ doc("assets_id") }}'
tests:
- not_null:
config:
Expand Down
10 changes: 5 additions & 5 deletions models/sources/src_history_effects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: cast(closed_at as datetime)
field: batch_run_date
interval: 12
config:
severity: warn
Expand Down Expand Up @@ -40,21 +40,21 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: details.liquidity_pool
description: '{{ doc("details_liquidity_pool") }}'
Expand Down Expand Up @@ -307,4 +307,4 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day
24 changes: 12 additions & 12 deletions models/sources/src_history_operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: closed_at
field: batch_run_date
interval: 12
config:
severity: warn
Expand All @@ -22,18 +22,18 @@ sources:
tests:
- unique:
config:
where: closed_at >= datetime_trunc(datetime_sub(current_timestamp(), interval 2 day), day)
and closed_at < datetime_trunc(current_timestamp(), day)
where: batch_run_date >= datetime_trunc(datetime_sub(current_datetime(), interval 2 day), day)
and batch_run_date < datetime_trunc(current_datetime(), day)
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: source_account
description: '{{ doc("source_account") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: source_account_muxed
description: '{{ doc("source_account_muxed") }}'
Expand All @@ -43,21 +43,21 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: type
description: '{{ doc("type") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: type_string
description: '{{ doc("type_string") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: details
description: '{{ doc("details") }}'
Expand Down Expand Up @@ -367,21 +367,21 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: details.asset_balance_changes
description: '{{ doc("details_asset_balance_changes") }}'
Expand Down Expand Up @@ -412,4 +412,4 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_timestamp - interval 2 day
where: batch_run_date > current_datetime - interval 2 day
46 changes: 23 additions & 23 deletions models/sources/src_history_transactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sources:
tests:
- dbt_utils.recency:
datepart: hour
field: closed_at
field: batch_run_date
interval: 12
config:
severity: warn
Expand All @@ -22,25 +22,25 @@ sources:
tests:
- unique:
config:
where: closed_at >= datetime_trunc(datetime_sub(current_datetime(), interval 2 day), day)
and closed_at < datetime_trunc(current_datetime(), day)
where: batch_run_date >= datetime_trunc(datetime_sub(current_datetime(), interval 2 day), day)
and batch_run_date < datetime_trunc(current_datetime(), day)
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: transaction_hash
description: '{{ doc("transaction_hash") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: ledger_sequence
description: '{{ doc("ledger_sequence") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: application_order
description: '{{ doc("application_order") }}'
Expand All @@ -50,42 +50,42 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: account_sequence
description: '{{ doc("account_sequence") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: max_fee
description: '{{ doc("max_fee") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: operation_count
description: '{{ doc("transaction_operation_count") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: created_at
description: '{{ doc("created_at") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: memo_type
description: '{{ doc("memo_type") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: memo
description: '{{ doc("memo") }}'
Expand All @@ -95,21 +95,21 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: successful
description: '{{ doc("successful") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: fee_charged
description: '{{ doc("fee_charged") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: inner_transaction_hash
description: '{{ doc("inner_transaction_hash") }}'
Expand Down Expand Up @@ -146,56 +146,56 @@ sources:
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: tx_result
description: '{{ doc("tx_result") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: tx_meta
description: '{{ doc("tx_meta") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: tx_fee_meta
description: '{{ doc("tx_fee_meta") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_id
description: '{{ doc("batch_id") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_run_date
description: '{{ doc("batch_run_date") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: batch_insert_ts
description: '{{ doc("batch_insert_ts") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: closed_at
description: '{{ doc("closed_at") }}'
tests:
- not_null:
config:
where: closed_at > current_datetime - interval 2 day
where: batch_run_date > current_datetime - interval 2 day

- name: refundable_fee
description: '{{ doc("refundable_fee") }}'
Expand Down
Loading

0 comments on commit 24a7213

Please sign in to comment.