osmosis-models/models/silver/silver__msgs.sql
eric-laurello d82b1b6082
AN-1195 changes from table review feedback (#10)
* updates

* name correction and uk update
2022-05-05 11:28:59 -04:00

27 lines
544 B
SQL

{{ config(
materialized = 'incremental',
unique_key = "CONCAT_WS('-', chain_id, block_id, tx_id, msg_index)",
incremental_strategy = 'delete+insert',
cluster_by = ['_ingested_at::DATE'],
) }}
SELECT
block_id,
block_timestamp,
blockchain,
chain_id,
tx_id,
tx_status,
INDEX AS msg_index,
VALUE :type :: STRING AS msg_type,
VALUE AS msg,
_ingested_at
FROM
{{ ref('silver__transactions') }} A,
LATERAL FLATTEN(input => A.msgs)
{% if is_incremental() %}
WHERE
_ingested_at :: DATE >= CURRENT_DATE - 2
{% endif %}