mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 14:06:44 +00:00
Some checks failed
docs_update / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_evm_daily_realtime / run_dbt_jobs (push) Has been cancelled
dbt_run_moments_metadata / run_dbt_jobs (push) Has been cancelled
dbt_observability_models / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_evm_daily_silver / run_dbt_jobs (push) Has been cancelled
dbt_run_evm_decoded_logs / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_transactions / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_transaction_results / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_external_realtime / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_external_points_balances_realtime / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_evm_realtime / run_dbt_jobs (push) Has been cancelled
dbt_run_scheduled / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_blocks / run_dbt_jobs (push) Has been cancelled
dbt_run_evm / run_dbt_jobs (push) Has been cancelled
dbt_run_scheduled_non_core / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_collections / run_dbt_jobs (push) Has been cancelled
docs_update / notify-failure (push) Has been cancelled
dbt_run_streamline_evm_daily_realtime / notify-failure (push) Has been cancelled
dbt_run_moments_metadata / notify-failure (push) Has been cancelled
dbt_observability_models / notify-failure (push) Has been cancelled
dbt_run_streamline_evm_daily_silver / notify-failure (push) Has been cancelled
dbt_run_evm_decoded_logs / notify-failure (push) Has been cancelled
dbt_run_streamline_transactions / notify-failure (push) Has been cancelled
dbt_run_streamline_transaction_results / notify-failure (push) Has been cancelled
dbt_run_streamline_external_realtime / notify-failure (push) Has been cancelled
dbt_run_streamline_external_points_balances_realtime / notify-failure (push) Has been cancelled
dbt_run_streamline_evm_realtime / notify-failure (push) Has been cancelled
dbt_run_scheduled / notify-failure (push) Has been cancelled
dbt_run_streamline_blocks / notify-failure (push) Has been cancelled
dbt_run_evm / notify-failure (push) Has been cancelled
dbt_run_scheduled_non_core / notify-failure (push) Has been cancelled
dbt_run_streamline_collections / notify-failure (push) Has been cancelled
dbt_run_streamline_decoded_logs_history / run_dbt_jobs (push) Has been cancelled
dbt_run_streamline_decoded_logs_history / notify-failure (push) Has been cancelled
* upd incr predicate on silver core models * upd rest of the models * rm predicate from d+i model
58 lines
1.8 KiB
SQL
58 lines
1.8 KiB
SQL
-- depends_on: {{ ref('bronze__streamline_transactions') }}
|
|
{{ config(
|
|
materialized = 'incremental',
|
|
unique_key = "tx_id",
|
|
incremental_strategy = 'merge',
|
|
incremental_predicates = ["dynamic_range_predicate", "_partition_by_block_id"],
|
|
merge_exclude_columns = ["inserted_timestamp"],
|
|
cluster_by = "_inserted_timestamp::date",
|
|
tags = ['streamline_load', 'core', 'scheduled_core']
|
|
) }}
|
|
|
|
SELECT
|
|
block_number,
|
|
DATA: reference_block_id :: STRING AS block_id,
|
|
id AS tx_id,
|
|
DATA: gas_limit :: NUMBER AS gas_limit,
|
|
DATA: payer :: STRING AS payer,
|
|
DATA: arguments :: ARRAY AS arguments,
|
|
DATA: authorizers :: ARRAY AS authorizers,
|
|
DATA: envelope_signatures :: ARRAY AS envelope_signatures,
|
|
DATA: payload_signatures :: ARRAY AS payload_signatures,
|
|
DATA: proposal_key :: variant AS proposal_key,
|
|
DATA: script :: STRING AS script,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['tx_id']
|
|
) }} AS streamline_tx_id,
|
|
SYSDATE() AS inserted_timestamp,
|
|
SYSDATE() AS modified_timestamp,
|
|
'{{ invocation_id }}' AS _invocation_id,
|
|
_partition_by_block_id,
|
|
_inserted_timestamp
|
|
FROM
|
|
|
|
{% if var('LOAD_BACKFILL', False) %}
|
|
{{ ref('bronze__streamline_transactions_history') }}
|
|
-- TODO need incremental logic of some sort probably (for those 5800 missing txs)
|
|
-- where inserted timestamp >= max from this where network version = backfill version OR block range between root and end
|
|
{% else %}
|
|
|
|
{% if is_incremental() %}
|
|
{{ ref('bronze__streamline_transactions') }}
|
|
WHERE
|
|
_inserted_timestamp >= (
|
|
SELECT
|
|
MAX(_inserted_timestamp) _inserted_timestamp
|
|
FROM
|
|
{{ this }}
|
|
)
|
|
{% else %}
|
|
{{ ref('bronze__streamline_fr_transactions') }}
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
qualify(ROW_NUMBER() over (PARTITION BY tx_id
|
|
ORDER BY
|
|
_inserted_timestamp DESC)) = 1
|