Skip to main content

Upsert

MySQL Plugin – Upsert Action

Summary (SEO Meta Description):
The Upsert Action of the MySQL Plugin allows workflows to insert new records or update existing ones in a MySQL database.
It ensures data consistency by avoiding duplicate entries while keeping records up to date.


Overview

The Upsert Action combines the behavior of Insert and Update.
If a record with the same primary key or unique constraint already exists, it will be updated instead of creating a duplicate.
If the record does not exist, it will be inserted.

This action is essential for workflows that need idempotent operations, ensuring data integrity when handling frequent updates or synchronization tasks.

Typical Use Cases:

  • Maintain unique user profiles in a database
  • Ensure workflow results don’t create duplicate records
  • Update or insert transaction logs in real-time
  • Sync patient or customer data across multiple systems

⚙️ Configuration

FieldDescriptionType / Options
LabelCustom name for the actionString
Select connectionChoose or create a MySQL database connectionDropdown
Table nameSelect the target tableDropdown
ColumnsDefine the columns to insert or updateString (multiple allowed)
MapAssign values to selected columnsKey-Value Mapping
ConditionOptional WHERE clause for update behaviorString
InputsManual mapping of input fields (optional)Name + Type
SchemaSelect or map input schemaSchema selector

FAQ

Q: What happens if the record exists?
A: If the primary key or unique key exists, the row is updated with new values.

Q: What happens if the record does not exist?
A: A new row will be inserted automatically.

Q: Can I use Upsert without a primary key?
A: No. Upsert requires either a primary key or a unique constraint in the table.


Keywords: WeHub MySQL Plugin, MySQL Upsert Action, Insert or Update MySQL, SQL Database Upsert, Workflow Database Integration