Share via

ADF to Snowflake sync setup UPSERT

Lina Vaitkiene 20 Reputation points
2026-03-18T10:06:43.4433333+00:00

I Azure Data Factory pipeline setup to sync data into my Snowflake account. Currently I use Snowflake V2 connector, but in my Copy Data action I can't select it to be UPSERT as INSERT duplicates entries which is not correct in my case.

How can I setup UPSERT for my data copy action?

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments

Answer accepted by question author
  1. SAI JAGADEESH KUDIPUDI 1,825 Reputation points Microsoft External Staff Moderator
    2026-03-20T17:38:35.3966667+00:00

    Hi **Lina Vaitkiene,
    **The behavior you’re seeing is expected. In Azure Data Factory, the Copy activity using Snowflake V2 connector does not support UPSERT (MERGE) operations. It only performs INSERT (append) or overwrite, which is why you are getting duplicate records.

    With the Snowflake V2 connector, Copy Activity is optimized for bulk loading via staging (COPY INTO). This mechanism:

    • Does not evaluate row-level conditions

    Does not support keys or matching logic

    Cannot perform UPDATE/MERGE semantics

    Therefore, UPSERT is not supported by design in Copy activity.

    1. ADF Native Approach): Mapping Data Flow

    Use Data Flow with Alter Row transformation

    Configure conditions like: upsertIf(true())

    In Sink (Snowflake):

    Enable Allow Upsert

      Define key columns
      
    

    This internally generates a MERGE statement against Snowflake and provides true UPSERT behavior.
    2. Copy Activity + Staging + MERGE (Most Common in Production)

    Copy data into a staging table in Snowflake

    1. Execute a MERGE statement using: Pre-copy or Post-copy script

    Example:

    MERGE INTO target t
    USING staging s
    ON t.id = s.id
    WHEN MATCHED THEN UPDATE SET ...
    WHEN NOT MATCHED THEN INSERT ...
    

    To achieve UPSERT in ADF with Snowflake V2, you must either use Mapping Data Flow (ADF-native MERGE) or implement staging + MERGE logic in Snowflake. Copy Activity alone cannot perform UPSERT due to its bulk-load architecture.
    Reference Links :
    https://learn.microsoft.com/azure/data-factory/data-flow-alter-row https://learn.microsoft.com/azure/data-factory/connector-snowflake#mapping-data-flow-properties

    https://learn.microsoft.com/azure/data-factory/copy-activity-overview#pre-and-post-copy-sql-statements

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    Please do not forget to "up-vote" wherever the information provided helps you, as this can be beneficial to other community members.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Lina Vaitkiene 20 Reputation points
    2026-03-25T06:20:22.45+00:00

    Thanks, in the end I did it with the staging table and upsert stored procedure make upserts to my actual table.

    0 comments No comments

  2. Jorre De Backer 5 Reputation points
    2026-03-18T11:10:26.1266667+00:00

    The Copy Activity doesn't support UPSERT with Snowflake V2 . Can you try swapping it for a Mapping Data Flow, add an Alter Row transformation with upsertIf(true()) and in the Sink settings, enable Allow Upsert, and set your key column. It's a bit more setup but it works well once configured.

    link https://learn.microsoft.com/en-us/azure/data-factory/data-flow-alter-row

    Alter row settings

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.