From a231c818efc6a9e84b774a0982f043b501ce79bd Mon Sep 17 00:00:00 2001 From: Eric Laurello Date: Fri, 7 Oct 2022 13:11:58 -0400 Subject: [PATCH] incremental logic and bespoke tests --- .../sequence_distinct_gaps_dim_block_id.sql | 42 +++++++++++++++++++ models/core/core__dim_block.sql | 2 +- .../core/core__fact_active_vault_events.sql | 8 ++++ models/core/core__fact_add_events.sql | 8 ++++ ...ore__fact_asgard_fund_yggdrasil_events.sql | 8 ++++ models/core/core__fact_block_pool_depths.sql | 8 ++++ models/core/core__fact_bond_actions.sql | 8 ++++ models/core/core__fact_bond_events.sql | 8 ++++ models/core/core__fact_errata_events.sql | 8 ++++ models/core/core__fact_fee_events.sql | 8 ++++ models/core/core__fact_gas_events.sql | 8 ++++ .../core/core__fact_inactive_vault_events.sql | 8 ++++ models/core/core__fact_liquidity_actions.sql | 2 +- models/core/core__fact_new_node_events.sql | 8 ++++ models/core/core__fact_outbound_events.sql | 2 +- .../core__fact_pending_liquidity_events.sql | 2 +- .../core__fact_pool_balance_change_events.sql | 8 ++++ .../core/core__fact_pool_block_balances.sql | 2 +- models/core/core__fact_pool_block_fees.sql | 2 +- models/core/core__fact_pool_events.sql | 8 ++++ models/core/core__fact_refund_events.sql | 2 +- models/core/core__fact_reserve_events.sql | 2 +- .../core/core__fact_rewards_event_entries.sql | 2 +- models/core/core__fact_rewards_events.sql | 2 +- .../core/core__fact_set_ip_address_events.sql | 2 +- models/core/core__fact_set_mimir_events.sql | 2 +- .../core/core__fact_set_node_keys_events.sql | 2 +- models/core/core__fact_set_version_events.sql | 2 +- models/core/core__fact_slash_amounts.sql | 2 +- models/core/core__fact_slash_points.sql | 2 +- models/core/core__fact_stake_events.sql | 2 +- models/core/core__fact_swaps.sql | 2 +- models/core/core__fact_switch_events.sql | 2 +- .../core__fact_thorname_change_events.sql | 2 +- .../core/core__fact_total_block_rewards.sql | 2 +- models/core/core__fact_transfer_events.sql | 2 +- models/core/core__fact_transfers.sql | 2 +- models/core/core__fact_unstake_events.sql | 2 +- ...fact_update_node_account_status_events.sql | 2 +- models/core/core__fact_upgrades.sql | 2 +- ...e__fact_validator_request_leave_events.sql | 2 +- models/silver/silver__block_rewards.yml | 5 +-- ...k_pool_depths__block_id-assert_no_gaps.sql | 1 + ..._fact_block_rewards__day-assert_no_gap.sql | 1 + ...act_daily_earnings__day-assert_no_gaps.sql | 1 + ...t_daily_pool_stats__day-assert_no_gaps.sql | 1 + ...re__fact_daily_tvl__day-assert_no_gaps.sql | 1 + ...lock_balances__block_id-assert_no_gaps.sql | 1 + ...act_pool_block_fees__day-assert_no_gap.sql | 1 + ...ol_block_statistics__day-assert_no_gap.sql | 1 + ...__fact_prices__block_id-assert_no_gaps.sql | 1 + ...swaps_assert_all_ids_exist_swap_events.sql | 1 + ...block_rewards__block_id-assert_no_gaps.sql | 5 +++ ..._total_value_locked__day-assert_no_gap.sql | 1 + 54 files changed, 190 insertions(+), 31 deletions(-) create mode 100644 macros/tests/sequence_distinct_gaps_dim_block_id.sql create mode 100644 tests/core__fact_block_pool_depths__block_id-assert_no_gaps.sql create mode 100644 tests/core__fact_block_rewards__day-assert_no_gap.sql create mode 100644 tests/core__fact_daily_earnings__day-assert_no_gaps.sql create mode 100644 tests/core__fact_daily_pool_stats__day-assert_no_gaps.sql create mode 100644 tests/core__fact_daily_tvl__day-assert_no_gaps.sql create mode 100644 tests/core__fact_pool_block_balances__block_id-assert_no_gaps.sql create mode 100644 tests/core__fact_pool_block_fees__day-assert_no_gap.sql create mode 100644 tests/core__fact_pool_block_statistics__day-assert_no_gap.sql create mode 100644 tests/core__fact_prices__block_id-assert_no_gaps.sql create mode 100644 tests/core__fact_swaps_assert_all_ids_exist_swap_events.sql create mode 100644 tests/core__fact_total_block_rewards__block_id-assert_no_gaps.sql create mode 100644 tests/core__fact_total_value_locked__day-assert_no_gap.sql diff --git a/macros/tests/sequence_distinct_gaps_dim_block_id.sql b/macros/tests/sequence_distinct_gaps_dim_block_id.sql new file mode 100644 index 0000000..cf54193 --- /dev/null +++ b/macros/tests/sequence_distinct_gaps_dim_block_id.sql @@ -0,0 +1,42 @@ +{% macro sequence_distinct_gaps_dim_block_id( + table, + column + ) %} + {%- set partition_sql = partition_by | join(", ") -%} + {%- set previous_column = "prev_" ~ column -%} + WITH source AS ( + SELECT + {{ partition_sql + "," if partition_sql }} + {{ column }}, + LAG( + {{ column }}, + 1 + ) over ( + ORDER BY + {{ column }} ASC + ) AS {{ previous_column }} + FROM + ( + SELECT + DISTINCT {{ column }} + FROM + {{ table }} A + JOIN {{ ref('core__dim_block') }} + b + ON A.dim_block_id = b.dim_block_id + WHERE + A.dim_block_id <> '-1' + ) + ) +SELECT + {{ previous_column }}, + {{ column }}, + {{ column }} - {{ previous_column }} + - 1 AS gap +FROM + source +WHERE + {{ column }} - {{ previous_column }} <> 1 +ORDER BY + gap DESC +{% endmacro %} diff --git a/models/core/core__dim_block.sql b/models/core/core__dim_block.sql index 8754c1d..65b0c8c 100644 --- a/models/core/core__dim_block.sql +++ b/models/core/core__dim_block.sql @@ -37,7 +37,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} UNION ALL SELECT diff --git a/models/core/core__fact_active_vault_events.sql b/models/core/core__fact_active_vault_events.sql index 5814b55..58b1382 100644 --- a/models/core/core__fact_active_vault_events.sql +++ b/models/core/core__fact_active_vault_events.sql @@ -25,6 +25,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR add_asgard_addr IN ( + SELECT + add_asgard_addr + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_add_events.sql b/models/core/core__fact_add_events.sql index 565cf1c..a75de91 100644 --- a/models/core/core__fact_add_events.sql +++ b/models/core/core__fact_add_events.sql @@ -34,6 +34,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_asgard_fund_yggdrasil_events.sql b/models/core/core__fact_asgard_fund_yggdrasil_events.sql index 8c78cfd..3c047df 100644 --- a/models/core/core__fact_asgard_fund_yggdrasil_events.sql +++ b/models/core/core__fact_asgard_fund_yggdrasil_events.sql @@ -28,6 +28,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_block_pool_depths.sql b/models/core/core__fact_block_pool_depths.sql index 18fdd18..b6002ef 100644 --- a/models/core/core__fact_block_pool_depths.sql +++ b/models/core/core__fact_block_pool_depths.sql @@ -27,6 +27,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR pool_name IN ( + SELECT + pool_name + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_bond_actions.sql b/models/core/core__fact_bond_actions.sql index b3b2316..8b320b6 100644 --- a/models/core/core__fact_bond_actions.sql +++ b/models/core/core__fact_bond_actions.sql @@ -42,6 +42,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_bond_events.sql b/models/core/core__fact_bond_events.sql index f9fc6eb..d3a2ace 100644 --- a/models/core/core__fact_bond_events.sql +++ b/models/core/core__fact_bond_events.sql @@ -32,6 +32,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_errata_events.sql b/models/core/core__fact_errata_events.sql index 2146838..28526e7 100644 --- a/models/core/core__fact_errata_events.sql +++ b/models/core/core__fact_errata_events.sql @@ -28,6 +28,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR asset IN ( + SELECT + asset + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_fee_events.sql b/models/core/core__fact_fee_events.sql index 5e2e5e8..787ec89 100644 --- a/models/core/core__fact_fee_events.sql +++ b/models/core/core__fact_fee_events.sql @@ -28,6 +28,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_gas_events.sql b/models/core/core__fact_gas_events.sql index dda9c01..cf09bdc 100644 --- a/models/core/core__fact_gas_events.sql +++ b/models/core/core__fact_gas_events.sql @@ -28,6 +28,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR asset IN ( + SELECT + asset + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_inactive_vault_events.sql b/models/core/core__fact_inactive_vault_events.sql index 95d3feb..e1974a1 100644 --- a/models/core/core__fact_inactive_vault_events.sql +++ b/models/core/core__fact_inactive_vault_events.sql @@ -25,6 +25,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR add_asgard_address IN ( + SELECT + add_asgard_address + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_liquidity_actions.sql b/models/core/core__fact_liquidity_actions.sql index 354ee2e..f33ec98 100644 --- a/models/core/core__fact_liquidity_actions.sql +++ b/models/core/core__fact_liquidity_actions.sql @@ -40,7 +40,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_new_node_events.sql b/models/core/core__fact_new_node_events.sql index bfa6ca5..025c5f9 100644 --- a/models/core/core__fact_new_node_events.sql +++ b/models/core/core__fact_new_node_events.sql @@ -25,6 +25,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR node_address IN ( + SELECT + node_address + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_outbound_events.sql b/models/core/core__fact_outbound_events.sql index d28af04..473b0c1 100644 --- a/models/core/core__fact_outbound_events.sql +++ b/models/core/core__fact_outbound_events.sql @@ -31,7 +31,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_pending_liquidity_events.sql b/models/core/core__fact_pending_liquidity_events.sql index 240f6eb..9f77b77 100644 --- a/models/core/core__fact_pending_liquidity_events.sql +++ b/models/core/core__fact_pending_liquidity_events.sql @@ -32,7 +32,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_pool_balance_change_events.sql b/models/core/core__fact_pool_balance_change_events.sql index 474dfdf..cab8804 100644 --- a/models/core/core__fact_pool_balance_change_events.sql +++ b/models/core/core__fact_pool_balance_change_events.sql @@ -30,6 +30,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR asset IN ( + SELECT + asset + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_pool_block_balances.sql b/models/core/core__fact_pool_block_balances.sql index 86bf21e..288d18c 100644 --- a/models/core/core__fact_pool_block_balances.sql +++ b/models/core/core__fact_pool_block_balances.sql @@ -30,7 +30,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_pool_block_fees.sql b/models/core/core__fact_pool_block_fees.sql index bfe9a03..f6d3d22 100644 --- a/models/core/core__fact_pool_block_fees.sql +++ b/models/core/core__fact_pool_block_fees.sql @@ -29,7 +29,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_pool_events.sql b/models/core/core__fact_pool_events.sql index 2f5ded4..03e7d35 100644 --- a/models/core/core__fact_pool_events.sql +++ b/models/core/core__fact_pool_events.sql @@ -26,6 +26,14 @@ WHERE FROM {{ this }} ) - INTERVAL '4 HOURS' + OR asset IN ( + SELECT + asset + FROM + {{ this }} + WHERE + dim_block_id = '-1' + ) {% endif %} ) SELECT diff --git a/models/core/core__fact_refund_events.sql b/models/core/core__fact_refund_events.sql index 750a6b0..f0c24e4 100644 --- a/models/core/core__fact_refund_events.sql +++ b/models/core/core__fact_refund_events.sql @@ -34,7 +34,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_reserve_events.sql b/models/core/core__fact_reserve_events.sql index 9fcdf2a..49d3e80 100644 --- a/models/core/core__fact_reserve_events.sql +++ b/models/core/core__fact_reserve_events.sql @@ -32,7 +32,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_rewards_event_entries.sql b/models/core/core__fact_rewards_event_entries.sql index c2aa07e..8f5dd0e 100644 --- a/models/core/core__fact_rewards_event_entries.sql +++ b/models/core/core__fact_rewards_event_entries.sql @@ -25,7 +25,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_rewards_events.sql b/models/core/core__fact_rewards_events.sql index ba1cd08..31f7f45 100644 --- a/models/core/core__fact_rewards_events.sql +++ b/models/core/core__fact_rewards_events.sql @@ -24,7 +24,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_set_ip_address_events.sql b/models/core/core__fact_set_ip_address_events.sql index 666c9c9..d51f530 100644 --- a/models/core/core__fact_set_ip_address_events.sql +++ b/models/core/core__fact_set_ip_address_events.sql @@ -25,7 +25,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_set_mimir_events.sql b/models/core/core__fact_set_mimir_events.sql index 713519f..cf01b41 100644 --- a/models/core/core__fact_set_mimir_events.sql +++ b/models/core/core__fact_set_mimir_events.sql @@ -25,7 +25,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_set_node_keys_events.sql b/models/core/core__fact_set_node_keys_events.sql index d00691d..1a41139 100644 --- a/models/core/core__fact_set_node_keys_events.sql +++ b/models/core/core__fact_set_node_keys_events.sql @@ -27,7 +27,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_set_version_events.sql b/models/core/core__fact_set_version_events.sql index 34c62d0..e8d7575 100644 --- a/models/core/core__fact_set_version_events.sql +++ b/models/core/core__fact_set_version_events.sql @@ -25,7 +25,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_slash_amounts.sql b/models/core/core__fact_slash_amounts.sql index a5835a7..2e4229d 100644 --- a/models/core/core__fact_slash_amounts.sql +++ b/models/core/core__fact_slash_amounts.sql @@ -26,7 +26,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_slash_points.sql b/models/core/core__fact_slash_points.sql index 11543f7..e618458 100644 --- a/models/core/core__fact_slash_points.sql +++ b/models/core/core__fact_slash_points.sql @@ -26,7 +26,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_stake_events.sql b/models/core/core__fact_stake_events.sql index 2c471f6..1d2ee08 100644 --- a/models/core/core__fact_stake_events.sql +++ b/models/core/core__fact_stake_events.sql @@ -33,7 +33,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_swaps.sql b/models/core/core__fact_swaps.sql index 5b0cb29..6aa21a5 100644 --- a/models/core/core__fact_swaps.sql +++ b/models/core/core__fact_swaps.sql @@ -47,7 +47,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_switch_events.sql b/models/core/core__fact_switch_events.sql index a2d212a..36cb31f 100644 --- a/models/core/core__fact_switch_events.sql +++ b/models/core/core__fact_switch_events.sql @@ -29,7 +29,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_thorname_change_events.sql b/models/core/core__fact_thorname_change_events.sql index 008441f..261c050 100644 --- a/models/core/core__fact_thorname_change_events.sql +++ b/models/core/core__fact_thorname_change_events.sql @@ -34,7 +34,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_total_block_rewards.sql b/models/core/core__fact_total_block_rewards.sql index 52699c0..875313e 100644 --- a/models/core/core__fact_total_block_rewards.sql +++ b/models/core/core__fact_total_block_rewards.sql @@ -26,7 +26,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_transfer_events.sql b/models/core/core__fact_transfer_events.sql index e4f6335..eb40938 100644 --- a/models/core/core__fact_transfer_events.sql +++ b/models/core/core__fact_transfer_events.sql @@ -27,7 +27,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_transfers.sql b/models/core/core__fact_transfers.sql index e1a3022..3648710 100644 --- a/models/core/core__fact_transfers.sql +++ b/models/core/core__fact_transfers.sql @@ -28,7 +28,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_unstake_events.sql b/models/core/core__fact_unstake_events.sql index de42e81..bb74752 100644 --- a/models/core/core__fact_unstake_events.sql +++ b/models/core/core__fact_unstake_events.sql @@ -38,7 +38,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_update_node_account_status_events.sql b/models/core/core__fact_update_node_account_status_events.sql index 49df4cb..43a4fe1 100644 --- a/models/core/core__fact_update_node_account_status_events.sql +++ b/models/core/core__fact_update_node_account_status_events.sql @@ -25,7 +25,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_upgrades.sql b/models/core/core__fact_upgrades.sql index 15dc1b3..6847f13 100644 --- a/models/core/core__fact_upgrades.sql +++ b/models/core/core__fact_upgrades.sql @@ -31,7 +31,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/core/core__fact_validator_request_leave_events.sql b/models/core/core__fact_validator_request_leave_events.sql index cf992bc..ca95dd5 100644 --- a/models/core/core__fact_validator_request_leave_events.sql +++ b/models/core/core__fact_validator_request_leave_events.sql @@ -26,7 +26,7 @@ WHERE ) FROM {{ this }} - ) - INTERVAL '4 HOURS' + ) - INTERVAL '48 HOURS' {% endif %} ) SELECT diff --git a/models/silver/silver__block_rewards.yml b/models/silver/silver__block_rewards.yml index 2a7fa7d..e187d6f 100644 --- a/models/silver/silver__block_rewards.yml +++ b/models/silver/silver__block_rewards.yml @@ -27,7 +27,4 @@ models: - name: LIQUIDITY_EARNINGS tests: - not_null - - name: AVG_NODE_COUNT - tests: - - not_null: - where: DAY < CURRENT_DATE - 2 \ No newline at end of file + - name: AVG_NODE_COUNT \ No newline at end of file diff --git a/tests/core__fact_block_pool_depths__block_id-assert_no_gaps.sql b/tests/core__fact_block_pool_depths__block_id-assert_no_gaps.sql new file mode 100644 index 0000000..d11bc39 --- /dev/null +++ b/tests/core__fact_block_pool_depths__block_id-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ sequence_distinct_gaps_dim_block_id (ref("core__fact_block_pool_depths"), "block_id") }} diff --git a/tests/core__fact_block_rewards__day-assert_no_gap.sql b/tests/core__fact_block_rewards__day-assert_no_gap.sql new file mode 100644 index 0000000..6a7f4cc --- /dev/null +++ b/tests/core__fact_block_rewards__day-assert_no_gap.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_block_rewards"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_daily_earnings__day-assert_no_gaps.sql b/tests/core__fact_daily_earnings__day-assert_no_gaps.sql new file mode 100644 index 0000000..28c25b4 --- /dev/null +++ b/tests/core__fact_daily_earnings__day-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_daily_earnings"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_daily_pool_stats__day-assert_no_gaps.sql b/tests/core__fact_daily_pool_stats__day-assert_no_gaps.sql new file mode 100644 index 0000000..65a1271 --- /dev/null +++ b/tests/core__fact_daily_pool_stats__day-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_daily_pool_stats"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_daily_tvl__day-assert_no_gaps.sql b/tests/core__fact_daily_tvl__day-assert_no_gaps.sql new file mode 100644 index 0000000..7906364 --- /dev/null +++ b/tests/core__fact_daily_tvl__day-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_daily_tvl"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_pool_block_balances__block_id-assert_no_gaps.sql b/tests/core__fact_pool_block_balances__block_id-assert_no_gaps.sql new file mode 100644 index 0000000..4870a35 --- /dev/null +++ b/tests/core__fact_pool_block_balances__block_id-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ sequence_distinct_gaps_dim_block_id(ref("corte__fact_pool_block_balances"), "block_id") }} diff --git a/tests/core__fact_pool_block_fees__day-assert_no_gap.sql b/tests/core__fact_pool_block_fees__day-assert_no_gap.sql new file mode 100644 index 0000000..c77881f --- /dev/null +++ b/tests/core__fact_pool_block_fees__day-assert_no_gap.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_pool_block_fees"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_pool_block_statistics__day-assert_no_gap.sql b/tests/core__fact_pool_block_statistics__day-assert_no_gap.sql new file mode 100644 index 0000000..1c7da6b --- /dev/null +++ b/tests/core__fact_pool_block_statistics__day-assert_no_gap.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_pool_block_statistics"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)")) }} diff --git a/tests/core__fact_prices__block_id-assert_no_gaps.sql b/tests/core__fact_prices__block_id-assert_no_gaps.sql new file mode 100644 index 0000000..b144002 --- /dev/null +++ b/tests/core__fact_prices__block_id-assert_no_gaps.sql @@ -0,0 +1 @@ +{{ sequence_distinct_gaps_dim_block_id(ref("core__fact_prices"), "block_id") }} diff --git a/tests/core__fact_swaps_assert_all_ids_exist_swap_events.sql b/tests/core__fact_swaps_assert_all_ids_exist_swap_events.sql new file mode 100644 index 0000000..c4ad79d --- /dev/null +++ b/tests/core__fact_swaps_assert_all_ids_exist_swap_events.sql @@ -0,0 +1 @@ +{{ all_ids_exist(ref("core__fact_swap_events"), "tx_id", ref("core__fact_swaps"), "tx_id") }} diff --git a/tests/core__fact_total_block_rewards__block_id-assert_no_gaps.sql b/tests/core__fact_total_block_rewards__block_id-assert_no_gaps.sql new file mode 100644 index 0000000..9df0a6d --- /dev/null +++ b/tests/core__fact_total_block_rewards__block_id-assert_no_gaps.sql @@ -0,0 +1,5 @@ +{{ config( + warn_if = "> 10", + severity = "warn" +) }} +{{ sequence_distinct_gaps_dim_block_id(ref("core__fact_total_block_rewards"), "block_id") }} diff --git a/tests/core__fact_total_value_locked__day-assert_no_gap.sql b/tests/core__fact_total_value_locked__day-assert_no_gap.sql new file mode 100644 index 0000000..5f24caf --- /dev/null +++ b/tests/core__fact_total_value_locked__day-assert_no_gap.sql @@ -0,0 +1 @@ +{{ date_gaps(ref("core__fact_total_value_locked"), [], "day", dict(start_date = "cast('2021-07-22' as date)", end_date = "cast('2021-08-11' as date)"), dict(start_date = "cast('2021-11-12' as date)", end_date = "cast('2021-11-18' as date)")) }}