-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support to Upsert/Insert Ignore on PDB #386
Commits on May 30, 2023
-
Add Support to Upsert/Insert Ignore on PDB
**Summary:** - Introduces the capability to perform batch insert operations with duplicated entries without throwing a unique constraint violation exception. This is achieved by adding a new prepared statement to a `MappedEntity` when it is loaded. This statement will upsert the duplicate entries and will be implemented to each engine accordingly. This way, this prepared statement (upsert) will be used in the batch processing associated with the entity when adding and flushing the entries, but using the upserting any duplicated entries. This commit introduces support for the H2 and PostgreSQL engines for this operation. - For the H2 engine, the prepared statement is the `MERGE` command which updates existing rows, and insert rows that don't exist. The documentation for this engine can be found [here](http://www.h2database.com/html/commands.html#merge_into) ```sql MERGE INTO <TARGET_ENTITY> (cols...) VALUES(vals...) ``` - For the PostgreSQL engine, the insert statement introduces a `ON CONFLICT` clause that specifies an alternative action to raising a unique violation or exclusion constraint violation error. For the implementation, it was added the `DO UPDATE` action which will updating the columsn to the new values. It uses the values of the special table `EXCLUDED` to update it to the new values. The documentation for this engine can be found [here](https://www.postgresql.org/docs/current/sql-insert.html) ```sql INSERT INTO <TARGET_ENTITY> (cols...) VALUES (vals...) ON CONFLICT DO UPDATE SET (cols...) = EXCLUDED.(cols...) ``` **Test:** - A new test was added to verify that a batch with duplicate entries successfully inserts only one entry and do not throw an exception. - The test suite was run for every supported engine (H2 and PostgreSQL).
Configuration menu - View commit details
-
Copy full SHA for e100a51 - Browse repository at this point
Copy the full SHA e100a51View commit details -
Add Support to Upsert/Insert Ignore on PDB
- Reverts import order to avoid boilerplate diff.
Configuration menu - View commit details
-
Copy full SHA for 348a22d - Browse repository at this point
Copy the full SHA 348a22dView commit details -
Add Support to Upsert/Insert Ignore on PDB
- Minor changes in the H2Engine MERGE command. - Refactors the INSERT ON CONFLICT in teh PostgreSqlEngine class, so it updates instead of ignoring duplicate entries. - Refactors test.
Configuration menu - View commit details
-
Copy full SHA for 2f0d1ff - Browse repository at this point
Copy the full SHA 2f0d1ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for d2f153b - Browse repository at this point
Copy the full SHA d2f153bView commit details
Commits on May 31, 2023
-
Add Support to Upsert/Insert Ignore on PDB
- Fix tests: Adds `assumeTrue` so it ignores the engines for two tests where the upsert prepared statement is not implemented.
Configuration menu - View commit details
-
Copy full SHA for 1658965 - Browse repository at this point
Copy the full SHA 1658965View commit details
Commits on Jun 1, 2023
-
Add Support to Upsert/Insert Ignore on PDB
- Fix tests: Adds cockroach db to exception as it extends the Postgres implementation.
Configuration menu - View commit details
-
Copy full SHA for 36a434c - Browse repository at this point
Copy the full SHA 36a434cView commit details
Commits on Jun 2, 2023
-
Add Support to Upsert/Insert Ignore on PDB
- Fix tests: Fixes the h2 assumption as it requires more than one h2 engine.
Configuration menu - View commit details
-
Copy full SHA for 1d32f7f - Browse repository at this point
Copy the full SHA 1d32f7fView commit details
Commits on Jun 7, 2023
-
Add Support to Upsert/Insert Ignore on PDB
- Addresses comments.
Configuration menu - View commit details
-
Copy full SHA for d626297 - Browse repository at this point
Copy the full SHA d626297View commit details -
Configuration menu - View commit details
-
Copy full SHA for 011ba2e - Browse repository at this point
Copy the full SHA 011ba2eView commit details