MergeUpdate
A Boolean property that determines whether batch UPDATE statements are automatically converted to MERGE statements. This applies only when the UPDATE statement’s WHERE clause exclusively includes the table’s primary key fields combined using the AND logical operator. When enabled, Snowflake optimizes updates by leveraging the MERGE mechanism instead of standard batch updates.
Data Type
bool
Default Value
false
Remarks
MergeUpdate allows for upsert functionality. This property is primarily intended for use with tools where you have no direct control over the queries being executed. Otherwise, as long as Query Passthrough is 'true', you could execute the MERGE command directly.
When this property is 'false', UPDATE statements are executed directly against the server. When it is set to 'true' and the UPDATE query contains the primary key field, Snowflake sends a MERGE query that executes an UPDATE if a match is found in Snowflake. For example this query:
UPDATE "Table" SET "NAME" = 'NewName', "AGE" = 10 WHERE "ID" = 1is sent to Snowflake as the following MERGE request:
MERGE INTO "Table" AS "Target" USING "RTABLE1_TMP_20eca05b-c050-47dd-89bc-81c7f617f877" AS "Source" ON ("Target"."ID" = "Source"."ID")
WHEN MATCHED THEN UPDATE SET "Target"."NAME" = "Source"."NAME", "Target"."AGE" = "Source"."AGE"