Skip to content

Commit

Permalink
#31: make incremental models with unique_key work
Browse files Browse the repository at this point in the history
  • Loading branch information
codeforkjeff committed Aug 19, 2022
1 parent de3313f commit a5fb205
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
{%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}

{%- if unique_key is not none -%}
{% call statement('sqlite_incremental_upsert') -%}
delete
from {{ target_relation }}
where ({{ unique_key }}) in (
select ({{ unique_key }})
from {{ tmp_relation }}
);
{%- endcall %}
{%- endif %}

{# difference here is sqlite doesn't want parens around the select query #}
Expand Down

0 comments on commit a5fb205

Please sign in to comment.