Skip to content

Commit

Permalink
fix: add order_index to unique key
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshchur committed Dec 22, 2024
1 parent 05ce62f commit 431f397
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ safe_settle_batch_swap_ExpandedOrders AS (
{% endif %}
), safe_settle_batch_swap_parsedOrderItems AS (
SELECT
index,
index as order_index,
JSON_ARRAY_GET(parsed_orders, index) AS parsed_order_data,
*
FROM safe_settle_batch_swap_ExpandedOrders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,12 @@ models:
- method
- call_tx_hash
- call_trace_address
- index
columns:
- name: method
description: "Call Method"
- name: order_index
description: "Index of the Order in Batch (0 if single order swap)"
- name: call_trace_address
description: "Call Trace Address"
- name: call_block_number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
file_format = 'delta',
incremental_strategy = 'merge',
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.call_block_time')],
unique_key = ['method', 'call_tx_hash', 'call_trace_address'],
unique_key = ['method', 'call_tx_hash', 'call_trace_address', 'order_index'],
post_hook='{{ expose_spells(blockchains = \'["ethereum"]\',
spell_type = "project",
spell_name = "paraswap_delta_v1",
Expand All @@ -24,6 +24,7 @@ with
,{{ delta_safe_settle_batch_swap('ethereum') }}
select
'delta_v1_settle_swap_model' as method,
0 as order_index,
call_trace_address,
call_block_number,
call_block_time,
Expand Down Expand Up @@ -53,6 +54,7 @@ select
union all
select
'delta_v1_safe_settle_batch_swap_model' as method,
order_index,
call_trace_address,
call_block_number,
call_block_time,
Expand Down

0 comments on commit 431f397

Please sign in to comment.