-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
[#65] Add _bulk_create
parameter to make
#134
[#65] Add _bulk_create
parameter to make
#134
Conversation
@berinhard @anapaulagomes I am not sure the root cause of the GitHub Action failures or whether there is anything I can do to fix them. For what it's worth, the tests are passing on my local machine (even the PostgreSQL and Postgis tests). |
I'm looking into it @timjklein36. |
@anapaulagomes it seems to be an issue with Ubuntu's repositories:
|
Yeah, I saw this @berinhard. I tried to fix it with a suggestion from the GA community but it didn't work (#135). I'll continue tomorrow. |
@timjklein36 could you, please, rebase your change? @anapaulagomes fixed the issue, so it should work now! |
- This enables the use of `bulk_create` for the models that are created with `_quantity` supplied. This could offer performance advantages when creating large quantities of data. - It works by instead "preparing" the models and supplying them to the `_base_manager.bulk_create`.
- This tests to make sure `_bulk_create` works with models that have custom Managers. - This adds an assertion that without `_bulk_create=True` there will be the number of queries to the DB equal to the value of `_quantity`.
3ee3668
to
db1a5da
Compare
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.
It looks good to me! My only note is about the use of _refresh_after_create
.
Thank you for another valuable contribution, @timjklein36.
- This is not needed when using _bulk_create since prepare does not save the models directly
- Kwarg already has a default value and `None` is not needed as a valid value, so no need for the `Optional` type.
@anapaulagomes @berinhard @amureki Ready for your re-review at your earliest convenience. Thanks! |
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.
This is great work! Thanks @timjklein36
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.
Awesome! 🏆
bulk_create
for the models that arecreated with
_quantity
supplied. This could offer performanceadvantages when creating large quantities of data.
to the
_base_manager.bulk_create
.Fixes #65