Skip to content

Commit

Permalink
use more efficient delete
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiurin committed Dec 4, 2023
1 parent 4741577 commit 02da301
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
{% if unique_key %}
{% if unique_key is sequence and unique_key is not string %}
delete from {{ target }}
where (
{% for key in unique_key %}
{{ target }}.{{ key }} in (select {{ key }} from {{ source }})
{{ "and " if not loop.last }}
{% endfor %}
where
({{ get_quoted_csv(unique_key) }}) in (
select {{ get_quoted_csv(unique_key) }}
from {{ source }}
)
{% if incremental_predicates %}
{% for predicate in incremental_predicates %}
and {{ predicate }}
{% endfor %}
{% endif %}
);
{% endif %};
{% else %}
delete from {{ target }}
where (
Expand Down

0 comments on commit 02da301

Please sign in to comment.