Skip to content

Commit

Permalink
Quickfix - Update retry_tx_ids in txs final (#209)
Browse files Browse the repository at this point in the history
* adj greatest to handle null val

* del if null from retry_tx_ids cte

* add not null test to ins timestamp
  • Loading branch information
forgxyz authored Oct 18, 2023
1 parent a181234 commit 19bbac4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 7 additions & 6 deletions models/silver/core/silver__streamline_transactions_final.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
WITH retry_tx_ids AS (

SELECT
tx_id
tx_id,
block_height
FROM
{{ this }}
WHERE
Expand Down Expand Up @@ -80,7 +81,7 @@ WHERE
MAX(DATE_TRUNC('day', _inserted_timestamp))
FROM
{{ this }}
) - INTERVAL '24 hours'
) - INTERVAL '3 days'
{% endif %}
),
FINAL AS (
Expand Down Expand Up @@ -117,10 +118,10 @@ FINAL AS (
tr.status,
tr.status_code,
GREATEST(
b._inserted_timestamp,
tr._inserted_timestamp,
t._inserted_timestamp
) :: timestamp_ntz AS _inserted_timestamp,
[b._inserted_timestamp],
[tr._inserted_timestamp],
[t._inserted_timestamp]
) [0] :: timestamp_ntz AS _inserted_timestamp,
t._partition_by_block_id
FROM
txs t
Expand Down
5 changes: 4 additions & 1 deletion models/silver/core/silver__streamline_transactions_final.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ models:
- name: block_timestamp
description: "{{ doc('block_timestamp') }}"
tests:
- not_null
- not_null:
where: block_height >= {{ var('STREAMLINE_START_BLOCK' )}}
- dbt_expectations.expect_column_values_to_be_of_type:
column_type: TIMESTAMP_NTZ

Expand Down Expand Up @@ -104,6 +105,8 @@ models:

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

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

0 comments on commit 19bbac4

Please sign in to comment.