Data Operation - Upsert

Undraw Data Processing

Data Operation - Upsert

About

A upsert operation is an operation against the data that will:

  • try to insert a record
  • and update it if it already exists (when a unique constraint is violated)

The data upsert operation supports the upsert operation.

Requirements

FAQ

Which unique constraint (primary/unique key) do you choose as update identifier ?

An upsert can only do an update on one unique constraint identifier.

This is not possible to specify two unique constraints and therefore Tabulify needs to choose one.

If you have multiple target unique constraints matched by the source columns, the process takes as unique constraint:

  • the first target unique key found in the source columns.
  • and if not present the target primary key.

Note that when a unique key is chosen, the other unique constraint (primary and unique key) are discarded in the update.

Why an upsert does not load all my rows

An upsert will load (insert/update) the rows on the unique key, not on the primary key.

So the number of rows loaded (inserted/updated) is the number of distinct value in the unique key.

If you have 100 distinct value in your primary key but 50 distinct value in your unique key, you will load only 50 records.




Related HowTo
Undraw Data Processing
Learning Tabulify - Step 6 - How to transfer Data Resources

In Tabulify, when you want to manipulate data, it's called a transfer. You want to move data, you transfer You want to copy data, you transfer You want to insert data, you transfer You want to...
Undraw Data Processing
Learning Tabulify - Step 8 - How to modify the content of a table

Tabulify learning guidetransfer step The transfer page should have made you familiar with the transfer concept where we have introduced the copy operation. The copy and move operation does not modify...
Undraw Data Processing
Tabul - How to load a CSV file into a SQL table

How to upload a CSV file into a SQL table in two steps

Task Runner