How to ignore 'duplicate key' errors

One Star

How to ignore 'duplicate key' errors

Hello all,
I'm sorry to bother you with stupid question, but I'm new to TOS and I'm not able to find anything similar in both UG and this forum.
I want to pump data from a MySQL schema to an other MySQL schema, ignoring duplicate key errors on destination table.
I gave a try to all available 'Action on data' on tMysqlOutput, but nothing seems to fit (I don't really want to update existing data).
Any suggestion would be very appreciated.
Thanks and regards,
Massimo
One Star

Re: How to ignore 'duplicate key' errors

Either fetch unique values from the database or use the tUniqueRow component for moving unique rows to the target table.
Thanks and Regards,
Pravu Mishra.
One Star

Re: How to ignore 'duplicate key' errors

Try the action "insert if not exist".
Highlighted
One Star

Re: How to ignore 'duplicate key' errors

Hi nkxxDV,
unfortunately the only 'Action on data' I get in Component panel of tMysqlOutput are:
- insert
- update
- insert or update
- update or insert
- delete
- replace
- insert or update on duplicate key or unique index
I run TOS 3.1.3 build r26090.
Regards,
Massimo
One Star

Re: How to ignore 'duplicate key' errors

Ok, indeed it only exists for tMSSqlOutput.
Then I suggest you to fetch all the primary keys from your destination table and use it as a lookup for your main flow. You will do the join on the primary key and only output rejected rows.
One Star

Re: How to ignore 'duplicate key' errors

It seems to be working.
Thanks,
Massimo
One Star kcd
One Star

Re: How to ignore 'duplicate key' errors

What about choosing insert or update on duplicate key or unique index AND Advanced Settings > Use Field Options and selecting the primary key column(s) as Updateable

edit: ETL seemed to work even without any updateable columns but this is invalid syntax and it would sometimes (?) recognise it or will hang so you are better to update the primary key (i.e. change nothing)