empty strings

This commit is contained in:
Eric Laurello 2023-12-19 12:48:35 -05:00
parent 494d10b74a
commit 53bb143e72

View File

@ -62,7 +62,6 @@ WITH base_atts AS (
*
FROM
silver.transfers__intermediate_tmp
),
sender AS (
SELECT
@ -315,7 +314,9 @@ fin AS (
'OSMOSIS' AS transfer_type,
r.msg_index,
sender,
amount,
TRY_CAST(
amount AS NUMBER
) AS amount,
currency,
DECIMAL,
receiver,
@ -345,10 +346,9 @@ fin AS (
) t
ON r.tx_id = t.tx_id
WHERE
(
amount IS NOT NULL
OR currency IS NOT NULL
)
TRY_CAST(
amount AS NUMBER
) IS NOT NULL
UNION ALL
SELECT
m.block_id,
@ -358,7 +358,9 @@ fin AS (
'IBC_TRANSFER_IN' AS transfer_type,
m.msg_index,
TRY_PARSE_JSON(attribute_value) :sender :: STRING AS sender,
C.amount :: NUMBER AS amount,
TRY_CAST(
C.amount AS NUMBER
) AS amount,
C.currency,
A.decimal,
COALESCE(TRY_PARSE_JSON(attribute_value) :receiver, TRY_PARSE_JSON(attribute_value) :msg :execute :msgs [0] :staking :delegate :validator, TRY_PARSE_JSON(attribute_value) :msg :execute :msgs [0] :bank :send :to_address, TRY_PARSE_JSON(attribute_value) :msg :execute :msgs [0] :wasm :execute :contract_addr, TRY_PARSE_JSON(attribute_value) :execute :Ok :executed_by) :: STRING AS receiver,
@ -382,10 +384,9 @@ fin AS (
TRY_PARSE_JSON(attribute_value) :sender :: STRING IS NOT NULL
AND m.msg_type = 'write_acknowledgement'
AND m.attribute_key = 'packet_data'
AND (
amount IS NOT NULL
OR currency IS NOT NULL
)
AND TRY_CAST(
C.amount AS NUMBER
) IS NOT NULL
AND receiver IS NOT NULL
),
links AS (
@ -468,12 +469,12 @@ SELECT
) AS foreign_chain,
A._inserted_timestamp,
A._unique_key,
{{ dbt_utils.generate_surrogate_key(
['a._unique_key']
) }} AS transfers_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
{{ dbt_utils.generate_surrogate_key(
['a._unique_key']
) }} AS transfers_id,
SYSDATE() AS inserted_timestamp,
SYSDATE() AS modified_timestamp,
'{{ invocation_id }}' AS _invocation_id
FROM
fin A
LEFT JOIN links b