MergeDelete Parameter (Connect-Snowflake Cmdlet)
A boolean indicating whether batch DELETE statements should be converted to MERGE statements automatically. Only used when the DELETE statement's where clause contains a table's primary key field only and they are combined with AND logical operator.
Syntax
Connect-Snowflake -MergeDelete SwitchParameter
Data Type
bool
Default Value
false
Remarks
A boolean indicating whether DELETE statements should be converted to MERGE statements automatically to allow 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, DELETE bulk statements won't executed against the server. When it is set to True and the DELETE query contains the primary key field, the Snowflake will send a MERGE query that will execute an DELETE if match is found in Snowflake. For example this query:
DELETE FROM "Table" WHERE "ID" = 1 AND "NAME" = 'Jerry'Will be 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" AND "Target"."NAME" = "Source"."NAME") WHEN MATCHED THEN DELETE