mirror of
https://github.com/FlipsideCrypto/optimism-models.git
synced 2026-02-06 15:02:11 +00:00
* new columns, deprecation notices, docs * docs and ymls * new column in silver logs * spacing * spacing * new decoded logs columns, updates for new core columns * updates for column changes * nft updates * minor updates * comments * docs * updates for native transfers * update for identifier * updates for identifier * deprecation notices updated * table notices * native transfers * core column changes and docs * misc updates * typo * ref * removed trace_address from native_transfers * misc updates * timestamps for native * missing changes * misc updates * nft updates * missing_decoding macro * l1 fee precise docs * removed trace address column from silver native transfers * deprecation date * ez_decoded_event_logs * standard pred * dbt_mega
39 lines
804 B
SQL
39 lines
804 B
SQL
{{ config(
|
|
materialized = 'incremental',
|
|
unique_key = "block_number",
|
|
merge_exclude_columns = ["inserted_timestamp"],
|
|
tags = ['non_realtime']
|
|
) }}
|
|
|
|
WITH base AS (
|
|
|
|
SELECT
|
|
block_number,
|
|
MIN(modified_timestamp) AS _inserted_timestamp,
|
|
COUNT(*) AS tx_count
|
|
FROM
|
|
{{ ref('core__fact_transactions') }}
|
|
|
|
{% if is_incremental() %}
|
|
WHERE
|
|
modified_timestamp >= (
|
|
SELECT
|
|
MAX(_inserted_timestamp) _inserted_timestamp
|
|
FROM
|
|
{{ this }}
|
|
)
|
|
{% endif %}
|
|
GROUP BY
|
|
block_number
|
|
)
|
|
SELECT
|
|
*,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['block_number']
|
|
) }} AS tx_count_id,
|
|
SYSDATE() AS inserted_timestamp,
|
|
SYSDATE() AS modified_timestamp,
|
|
'{{ invocation_id }}' AS _invocation_id
|
|
FROM
|
|
base
|