-
-
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
Use bulk_create when supplying _quantity parameter to baker.make #65
Comments
It may not make sense to use
With that in mind, we could expose a second attribute related to |
Totally agree with you @timjklein36! This fix shouldn't change bakery's default behavior of calling save, but enables it to use bulk create if the caller wants too. I'm a +1 from having a |
Working on a PR now that adds |
I noticed that when using the
_quantity
parameter withbaker.make
, each model instance is added to the database individually (see this line: https://github.com/model-bakers/model_bakery/blob/master/model_bakery/baker.py#L356).Would it be reasonable to use django's
bulk_create
manager method to create them all in one database query in that situation? The difference in efficiency could be significant when running test suites which use that parameter often enough.The text was updated successfully, but these errors were encountered: