Reputation: 27
I'm using the copy into feature and was wondering if there's a way to upsert? I currently have a primary key on a column and when copying another file with matching primary keys it writes a new row in. Is there a way to upsert the original row using the copy into feature? Thanks!
Upvotes: 2
Views: 1334
Reputation: 25928
from COPY INTO you cannot upsert, but with the MERGE command you can, via the SELECT being from the STAGING location, but I am not sure if this avoid duplicate file reads as the COPY provides. We load via COPY into a temporary table, then MERGE into our tables, which allows allows transforming after the load, thus ELT instead of ETL..
Upvotes: 1