mirror of
https://github.com/FlipsideCrypto/osmosis-models.git
synced 2026-02-06 11:26:55 +00:00
* check in * WIP check in * WIP check in * locked LP actions and balances * add business logic test, fix test failure & typos * ds store * ds store * more logic tests
57 lines
867 B
SQL
57 lines
867 B
SQL
{{ config(
|
|
materialized = 'incremental',
|
|
unique_key = "_unique_key",
|
|
incremental_strategy = 'merge',
|
|
cluster_by = ['_inserted_timestamp::DATE']
|
|
) }}
|
|
|
|
WITH b AS (
|
|
|
|
SELECT
|
|
block_id,
|
|
block_timestamp,
|
|
blockchain,
|
|
chain_id,
|
|
tx_id,
|
|
tx_status,
|
|
INDEX AS msg_group,
|
|
VALUE :"@type" :: STRING AS msg_type,
|
|
VALUE AS msg,
|
|
_inserted_timestamp
|
|
FROM
|
|
{{ ref('silver__transactions') }} A,
|
|
LATERAL FLATTEN(
|
|
input => A.tx_body :messages
|
|
)
|
|
|
|
{% if is_incremental() %}
|
|
WHERE
|
|
_inserted_timestamp >= (
|
|
SELECT
|
|
MAX(
|
|
_inserted_timestamp
|
|
)
|
|
FROM
|
|
{{ this }}
|
|
)
|
|
{% endif %}
|
|
)
|
|
SELECT
|
|
block_id,
|
|
block_timestamp,
|
|
blockchain,
|
|
chain_id,
|
|
tx_id,
|
|
tx_status,
|
|
msg_group,
|
|
msg_type,
|
|
msg,
|
|
concat_ws(
|
|
'-',
|
|
tx_id,
|
|
msg_group
|
|
) AS _unique_key,
|
|
_inserted_timestamp
|
|
FROM
|
|
b
|