An 3222/refine test (#565)

* add null check

* join key
This commit is contained in:
Austin 2023-05-30 11:56:07 -04:00 committed by GitHub
parent f59d5acdda
commit eedc74c9eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 15 deletions

View File

@ -29,7 +29,13 @@ FROM
LEFT JOIN model_name
ON block_base.block_number = model_name.block_number
WHERE
tx_count <> model_tx_count
(
tx_count <> model_tx_count
)
OR (
model_tx_count IS NULL
AND tx_count <> 0
)
{% endmacro %}
{% macro recent_tx_gaps(
@ -63,5 +69,11 @@ FROM
LEFT JOIN model_name
ON block_base.block_number = model_name.block_number
WHERE
tx_count <> model_tx_count
(
tx_count <> model_tx_count
)
OR (
model_tx_count IS NULL
AND tx_count <> 0
)
{% endmacro %}

View File

@ -83,14 +83,12 @@ new_records AS (
FROM
flat_logs l
LEFT OUTER JOIN {{ ref('silver__transactions') }}
txs USING (
block_number,
tx_hash
)
txs
ON l.block_number = txs.block_number
AND l.tx_hash = txs.tx_hash
{% if is_incremental() %}
WHERE
txs._INSERTED_TIMESTAMP >= '{{ lookback() }}'
AND txs._INSERTED_TIMESTAMP >= '{{ lookback() }}'
{% endif %}
)

View File

@ -257,8 +257,7 @@ flattened_traces AS (
AND f.block_number = t.block_number
{% if is_incremental() %}
WHERE
t._INSERTED_TIMESTAMP >= '{{ lookback() }}'
AND t._INSERTED_TIMESTAMP >= '{{ lookback() }}'
{% endif %}
)

View File

@ -118,14 +118,13 @@ new_records AS (
r
ON A.block_number = r.block_number
AND A.data :hash :: STRING = r.tx_hash
LEFT OUTER JOIN {{ ref('silver__blocks') }}
b
ON A.block_number = b.block_number
{% if is_incremental() %}
WHERE
r._INSERTED_TIMESTAMP >= '{{ lookback() }}'
AND r._INSERTED_TIMESTAMP >= '{{ lookback() }}'
{% endif %}
LEFT OUTER JOIN {{ ref('silver__blocks') }}
b
ON A.block_number = b.block_number
)
{% if is_incremental() %},