Back to glossary

Upsert

An upsert is a database operation that inserts a record if it doesn't exist or updates it if it does — the safe way to write data idempotently across systems.

What is an upsert?

Upsert (UPDATE + INSERT) is the operation pattern: try to update an existing record matched by key; if none exists, insert a new one. The result is the same regardless of whether the record was already there — making upserts idempotent and safe to retry.

Why it matters

  • Re-running a workflow doesn't create duplicates
  • Sync jobs from external sources can run on a schedule without manual dedup
  • The standard pattern for ETL/reverse-ETL writes into operational systems

Implementation patterns

  • SQL: INSERT ... ON CONFLICT (key) DO UPDATE SET ... (Postgres)
  • MongoDB: updateOne with upsert:true
  • REST APIs: PUT semantics or explicit upsert endpoints
  • CRM bulk writes: most modern CRMs (HubSpot, Salesforce, Pipedrive) expose upsert endpoints keyed on email or external ID

How TexAu helps

TexAu workflows use upsert semantics by default when writing to your CRM — match on email or external ID, update if found, insert if not — so re-running a workflow is always safe.

Related