From ea46f3ee02429ef63d86beaa5cb3bf9a785eef5e Mon Sep 17 00:00:00 2001 From: Jack Forgash <58153492+forgxyz@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:17:45 -0600 Subject: [PATCH] Adj Test on Beta and Upd Staking Actions (#206) --- .../gold/beta/beta__ez_nft_topshot_packs.yml | 57 +------------------ .../staking/silver__staking_actions_s.sql | 32 ++++++++--- 2 files changed, 26 insertions(+), 63 deletions(-) diff --git a/models/gold/beta/beta__ez_nft_topshot_packs.yml b/models/gold/beta/beta__ez_nft_topshot_packs.yml index 7f0e9a9..cfbc873 100644 --- a/models/gold/beta/beta__ez_nft_topshot_packs.yml +++ b/models/gold/beta/beta__ez_nft_topshot_packs.yml @@ -3,84 +3,29 @@ version: 2 models: - name: beta__ez_nft_topshot_packs description: |- - This ez_ view contains the NBA TopShot nfts transfers related to rips. These are assumed to be packs that were purchased and opened. This is an alpha version and does not have sale price or pack name at this time. + Deprecating soon. This model was a beta table and will no longer be supported. This ez_ view contains the NBA TopShot nfts transfers related to rips. These are assumed to be packs that were purchased and opened. This is an alpha version and does not have sale price or pack name at this time. - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - tx_id - - buyer - - nft_id - columns: - name: TX_ID description: "{{ doc('tx_id') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - name: BLOCK_HEIGHT description: "{{ doc('block_height') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - name: BLOCK_TIMESTAMP description: "{{ doc('block_timestamp') }}" - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - name: MARKETPLACE description: "{{ doc('marketplace') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - name: NFT_ID description: "{{ doc('nft_id') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - NUMBER - name: BUYER description: "{{ doc('buyer') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - name: SELLER description: "{{ doc('seller') }}" - - - name: TX_SUCCEEDED description: "{{ doc('tx_succeeded') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - BOOLEAN - diff --git a/models/silver/staking/silver__staking_actions_s.sql b/models/silver/staking/silver__staking_actions_s.sql index ce3cbb2..fc6a3f6 100644 --- a/models/silver/staking/silver__staking_actions_s.sql +++ b/models/silver/staking/silver__staking_actions_s.sql @@ -12,8 +12,6 @@ WITH silver_events AS ( * FROM {{ ref('silver__streamline_events') }} - -- WHERE - -- event_data :: STRING != '{}' {% if is_incremental() %} WHERE @@ -23,6 +21,15 @@ WHERE FROM {{ this }} ) + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + _inserted_timestamp >= SYSDATE() - INTERVAL '14 days' + AND delegator IS NULL + ) {% endif %} ), flow_staking AS ( @@ -69,11 +76,22 @@ add_auth AS ( ) {% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - FROM - {{ this }} +AND ( + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) + FROM + {{ this }} + ) + OR tx_id IN ( + SELECT + tx_id + FROM + {{ this }} + WHERE + _inserted_timestamp >= SYSDATE() - INTERVAL '14 days' + AND delegator IS NULL + ) ) {% endif %} ),