-
-
Notifications
You must be signed in to change notification settings - Fork 483
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 ignore_conflicts to bulk_create_with_history #733
Conversation
Codecov Report
@@ Coverage Diff @@
## master #733 +/- ##
=======================================
Coverage 97.44% 97.44%
=======================================
Files 18 18
Lines 980 980
Branches 148 148
=======================================
Hits 955 955
Misses 12 12
Partials 13 13
Continue to review full report at Codecov.
|
Hi, I am opening this PR to propose a solution to #732. Please take a look and let me know what you think? Thank you. |
@shihanng would you mind rebasing? Think it looks good otherwise but I'll let @rossmechanic chime in. |
b13fe62
to
6dc1536
Compare
@ThePumpingLemma, rebased. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Not sure code climate is ever going to run. /shrug |
Description
If we are to support
ignore_conflicts
, we need to consider that not all item in the list of objects will be bulk created due to conflicts. Then, we also need to make sure that we create history records only for those objects that we created successfully. Unfortunately, we can't rely on the return value ofbulk_create
API because it returns all objects including those it ignores. Therefore, wheneverignore_conflicts=True
we need to "force" the second transaction to query the created objects.Related Issue
Close #732
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
make format
command to format my codeAUTHORS.rst
CHANGES.rst