Indeed, I try to insert rows into an MySQL table with the “DB Writer” node
The table in destination is empty and without primary key only index
But each time I execute my dataflow the same error coming:
ERROR DB Writer Execute failed: Duplicate entry ‘’ for key ‘PRIMARY’
Hi,
Are you quite sure there is no primary key? Can you share the output of SHOW CREATE TABLE your-table-name? This should tell us more about the existing table and its indexes.
Kind regards
Alexander
Could you show us the SQL you entered when you created the table? (Maybe you still have it in a working document or a MySQLWorkbench document?)
The error message being generated is actually coming out of MySQL (it’s error code 1062) - so the database is really under them impression that you’ve assigned a PRIMARY constraint to one or more columns.
In lieu of there being a way in KNIME to turn on some sort of logging which lists the INSERT transactions being sent to your database, perhaps you could turn on logging in your database to see what problem INSERTs are?
(Also, have you, for testing, assured that the table is totally empty before running the workflow? And once the workflow runs like this and fails, have you then in some other application (like command line mysql) verified that the table is still empty? (If there was a single batch INSERT that failed on the KNIME side, I believe the transaction is rolled back.))
This is a ‘user’ table, therefore I would EXPECT at least the user_id & likely user_name to be required to be unique. Which means there needs to be some sort of primary key defined in order to prevent collisions.