Skip to content

Commit

Permalink
add merge predicate to improve incremental run times (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
desmond-hui authored Oct 20, 2023
1 parent 65fd16a commit ea313f6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/silver/nfts/silver__nft_mint_actions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', tx_id, index, inner_index, mint)",
incremental_strategy = 'delete+insert',
incremental_predicates = ['block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
cluster_by = ['block_timestamp::DATE'],
) }}

Expand Down
1 change: 1 addition & 0 deletions models/silver/silver__mint_actions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', tx_id, event_type, mint)",
incremental_strategy = 'delete+insert',
incremental_predicates = ['block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
cluster_by = ['block_timestamp::DATE','_inserted_timestamp::DATE']
) }}

Expand Down
1 change: 1 addition & 0 deletions models/silver/tokens/silver__token_mint_actions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
materialized = 'incremental',
unique_key = "CONCAT_WS('-', tx_id, index, inner_index, mint)",
incremental_strategy = 'delete+insert',
incremental_predicates = ['block_timestamp::date >= LEAST(current_date-7,(select min(block_timestamp)::date from ' ~ generate_tmp_view_name(this) ~ '))'],
cluster_by = ['block_timestamp::DATE'],
) }}

Expand Down

0 comments on commit ea313f6

Please sign in to comment.