mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 11:27:00 +00:00
parent
04e65ffe1d
commit
a269422a90
@ -337,28 +337,6 @@ FROM
|
||||
WHERE modified_timestamp >= '{{ max_modified_timestamp }}'
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
swapper,
|
||||
swap_from_amount,
|
||||
swap_from_mint,
|
||||
swap_to_amount,
|
||||
swap_to_mint,
|
||||
program_id,
|
||||
'Saber Stable Swap' as swap_program,
|
||||
swap_index,
|
||||
swaps_intermediate_saber_id as fact_swaps_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__swaps_intermediate_saber') }}
|
||||
{% if is_incremental() %}
|
||||
WHERE modified_timestamp >= '{{ max_modified_timestamp }}'
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
@ -454,6 +432,25 @@ FROM
|
||||
l
|
||||
ON s.program_id = l.address
|
||||
union all
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
swapper,
|
||||
swap_from_amount,
|
||||
swap_from_mint,
|
||||
swap_to_amount,
|
||||
swap_to_mint,
|
||||
program_id,
|
||||
'Saber Stable Swap' as swap_program,
|
||||
concat_ws('-',tx_id,swap_index,swap_program) as _log_id,
|
||||
swaps_intermediate_saber_id as fact_swaps_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__swaps_intermediate_saber_view') }}
|
||||
UNION ALL
|
||||
{% endif %}
|
||||
|
||||
select
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
unique_key = ["block_id","tx_id","action_index"],
|
||||
merge_predicates = ["DBT_INTERNAL_DEST.block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from {{ this }}__dbt_tmp))"],
|
||||
cluster_by = ['block_timestamp::DATE','modified_timestamp::DATE'],
|
||||
tags = ['scheduled_non_core']
|
||||
full_refresh = false,
|
||||
enabled = false,
|
||||
) }}
|
||||
|
||||
WITH base_events AS(
|
||||
|
||||
@ -217,34 +217,6 @@ WHERE
|
||||
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
swap_index,
|
||||
swapper,
|
||||
swap_from_amount,
|
||||
swap_from_mint,
|
||||
swap_to_amount,
|
||||
swap_to_mint,
|
||||
program_id,
|
||||
_inserted_timestamp,
|
||||
swaps_intermediate_saber_id as marinade_swaps_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id
|
||||
FROM
|
||||
{{ ref('silver__swaps_intermediate_saber') }}
|
||||
WHERE
|
||||
(swap_from_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}') OR swap_to_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}'))
|
||||
AND succeeded
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
@ -383,4 +355,32 @@ WHERE
|
||||
AND succeeded
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= '{{ max_inserted_timestamp }}'
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not is_incremental() %}
|
||||
-- Only select from the deprecated model during the initial FR
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
index,
|
||||
inner_index,
|
||||
swap_index,
|
||||
swapper,
|
||||
swap_from_amount,
|
||||
swap_from_mint,
|
||||
swap_to_amount,
|
||||
swap_to_mint,
|
||||
program_id,
|
||||
_inserted_timestamp,
|
||||
swaps_intermediate_saber_id as marinade_swaps_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
'{{ invocation_id }}' AS invocation_id
|
||||
FROM
|
||||
{{ ref('silver__swaps_intermediate_saber_view') }}
|
||||
WHERE
|
||||
(swap_from_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}') OR swap_to_mint IN ('{{ MNDE_MINT }}', '{{ MSOL_MINT }}'))
|
||||
AND succeeded
|
||||
{% endif %}
|
||||
@ -6,7 +6,8 @@
|
||||
incremental_predicates = ["dynamic_range_predicate", "block_timestamp::date"],
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
cluster_by = ['block_timestamp::DATE','modified_timestamp::DATE'],
|
||||
tags = ['scheduled_non_core','scheduled_non_core_hourly'],
|
||||
full_refresh = false,
|
||||
enabled = false,
|
||||
) }}
|
||||
|
||||
{% if execute %}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_id,
|
||||
block_timestamp,
|
||||
program_id,
|
||||
tx_id,
|
||||
succeeded,
|
||||
swap_index,
|
||||
index,
|
||||
inner_index,
|
||||
swapper,
|
||||
swap_from_amount,
|
||||
swap_from_mint,
|
||||
swap_to_amount,
|
||||
swap_to_mint,
|
||||
_inserted_timestamp,
|
||||
swaps_intermediate_saber_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp,
|
||||
_invocation_id
|
||||
FROM
|
||||
{{ source(
|
||||
'solana_silver',
|
||||
'swaps_intermediate_saber'
|
||||
) }}
|
||||
@ -120,6 +120,7 @@ sources:
|
||||
- name: nft_sales_tensorswap_buysellevent
|
||||
- name: nft_sales_tensorswap
|
||||
- name: nft_sales_hadeswap_decoded
|
||||
- name: swaps_intermediate_saber
|
||||
- name: solana_streamline
|
||||
database: solana
|
||||
schema: streamline
|
||||
|
||||
Loading…
Reference in New Issue
Block a user