Closed clemensrieder closed 1 year ago
Hi,
If I understand well, you are asking for a possibility to add an ON CONFLICT DO NOTHING
clause at end of the insert?
Thank you for your quick answer! I was thinking about that - yes!
Commit c6a83c8 adds this feature.
INSERT_ON_CONFLICT
When enabled this instruct Ora2Pg to add an ON CONFLICT DO NOTHING
clause to all INSERT statements generated for this type of data
export.
Hi everyone,
I am in the process of exporting a really, really messy Oracle database via your fantastic tool. Unfortunately, the export takes quite some time. Since there is live data written to the database I get incongruencies when I try to add my foreign keys at the end.
An example: Table1.fk is linked to Table2.pk. Table1 is exported. The user deletes the corresponding Table2.pk. It seems there is no CASCADE setting in place. Table2 gets exported a bit later. Adding the foreign key constraint after importing the data will tell me that Table1.fk cannot be set because there is no corresponding Table2.pk.
PostgreSQL's COPY statement seems somewhat limited to work with errors but I read that the INSERT statement has an ON CONFLICT clause.
It would be super interesting to see this clause implemented in the ora2pg.conf options. Although it is slower it would help a lot in importing such data. As of now, I will write a short Python script adding the clause to each statement 🙂
What's your thought on that?