To prevent accidental multiple DB insert operation

Hello KNIME tearm members:
Please advise how to prevent accidental multiple DB insert operation in order to protect data uniquity in DB.
捕获

Hi @wooddenbowl ,

If you need to verify an exists data from the database and then, insert only the new one, you need to build a loader step and make a join to check it.

image

First at the print above, I select data from a excel file as example, make a sort process and insert into a joiner node at the first port to validate it.

Second, I select data from my database with the table selector and reader nodes for it and insert into the joiner at the second port.

With It, I can compare both values and understand which ones matches, have only at the the file and have only at the database.

From the joiner node, as you can see, I compare 2 columns (left as excel, righty as database) by the same ID.

I use include output with the 3 marks to see or use it as the print to just view (match), insert and update depending about the results.

If matches, I just make a update or nothing (top output port).
If new, Use the middle port.
If exists or need to be deleted, I use bottom port (in my case, ok?)

Example: KNIME_project_database check.knwf (24.8 KB)

Could it solve for you?

BR,

Denis

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.