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
| Field | Description | Type / Options | 
|---|---|---|
| Label | Custom name for the action | String | 
| Select connection | Choose or create a MySQL database connection | Dropdown | 
| Table name | Select the target table | Dropdown | 
| Columns | Define the columns to insert or update | String (multiple allowed) | 
| Map | Assign values to selected columns | Key-Value Mapping | 
| Condition | Optional WHERE clause for update behavior | String | 
| Inputs | Manual mapping of input fields (optional) | Name + Type | 
| Schema | Select or map input schema | Schema 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