Skip to main content
If a row with the same key exists, it is updated. Otherwise, a new row is inserted. You can also limit updates to specific columns, so only selected values are changed in matching rows.

Parameters

Example: Upsert vehicle types

A vehicle registry uses vehicle_id as the merge key. The merge column is set to type, so matching vehicles have their type updated. Vehicles that do not exist in the target table are inserted as new rows.
Existing target tableIncoming datasetResulting target tableBecause the merge column is set to TYPE, Prophecy updates only that column for matching rows. Columns that are not included in the merge remain unchanged. Rows that do not match the merge key are inserted as new rows. In this example, vehicles 101 and 102 have updated TYPE values, vehicle 103 remains unchanged, and vehicle 104 is inserted with a null value for REGISTERED_AT because that column was not included in the incoming dataset.