solana-models/models/streamline/parser/streamline__all_undecoded_instructions.sql
xiuy001 3707093464
Add solana parser jobs and models (#316)
* updated the dbt model for adding the solana parser

* updated

* updated

* updated

* updated
2023-07-21 18:33:08 +02:00

53 lines
1.0 KiB
SQL

{{ config (
materialized = "incremental",
unique_key = "CONCAT_WS('-', tx_id, INDEX)",
cluster_by = "ROUND(block_id, -3)"
) }}
WITH idl_in_play AS (
SELECT
LOWER(
REPLACE(SPLIT_PART(metadata$filename, '/', 3), '.json')
) AS program_id
FROM
{{ source(
'bronze_streamline',
'decode_instructions_idls'
) }}
),
instr_in_play AS (
SELECT
A.program_id,
tx_id,
INDEX,
instruction,
block_id,
block_timestamp
FROM
{{ ref('silver__events') }} A
JOIN idl_in_play b
ON LOWER(
A.program_id
) = b.program_id
)
SELECT
p.program_id,
p.tx_id,
p.index,
p.instruction,
p.block_id,
p.block_timestamp
FROM
instr_in_play p
LEFT OUTER JOIN {{ source(
'bronze',
'decoded_instructions'
) }}
d
ON p.tx_id = d.tx_id
AND p.index = d.index
AND p.block_timestamp = d.block_timestamp
WHERE
d.tx_id IS NULL