mirror of
https://github.com/FlipsideCrypto/blast-models.git
synced 2026-02-06 11:06:46 +00:00
* new columns ymls and docs * new column in silver logs * refs to core fact tables * ymls and new columns * minor updates * columns * docs * updates for native transfer * updates * deprecation notices * native transfers table * core column changes and docs * full_decoded_log changes * merge * misc updates for deprecating columns * tx and trace status * misc updates * remove comments * remove trace_address from native_transfers * timestamps for native * docs * token transfers * missing_decoding macro * l1 fee precise * removed trace address column from silver native transfers * deprecation date * ez decoded_event_logs * standard pred
39 lines
784 B
SQL
39 lines
784 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)
|
|
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
|