Mariia Zaharova
posted this
05 December 2019
Admin
Hello Jonas!
We have checked your package. You are using the UPSERT operation for your scenario. The UPSERT operation updates a record if it exists or inserts a new record. This allows you to avoid inserting duplicate data. You need to map the target ID/Primary key columns for performing UPSERT.
In Skyvia, UPSERT determines what action to perform in the following way: if a Null value is specified for the ID or primary key, UPSERT operation inserts the record, and if a non-null value is specified, UPSERT operation tries to update the record with the specified ID or primary key. Skyvia does not actually check if such record exists, and providing invalid ID/PK values results in failed records. For target Id mapping it is better to use Lookup mapping. To use the Lookup mapping, you need to have a column (or a set of columns) that uniquely identifies a record, other than the primary key.
For example:

JIC: When using lookup mapping for ID or PK columns in UPSERT, don't forget to select the Set null when no match found checkbox in Lookup Options. Otherwise, the lookup will produce errors if no such record found, and there would be failed records instead of inserted new ones.
The lookup above will try to find CompanyId where Customer = id (CustomerId) and update it; if no record is found - the new Company will be inserted.
Thus, please change your mapping and try again.
Best regards,
Mariia