Skip to content
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 option to use bulk_create for creating non-multi-table models #40

Open
WilliamYuhangLee opened this issue Apr 4, 2024 · 1 comment

Comments

@WilliamYuhangLee
Copy link

WilliamYuhangLee commented Apr 4, 2024

Add option to use bulk_create for creates: assert model is not multi-table, if enabled

Hi, as listed in one of the Todos, do you have a timeline for adding this option?

Your library otherwise provides so much convenience for bulk-upserting, but when it comes to simple models, using bulk creates would be so much faster than individual creates!

@fopina
Copy link
Owner

fopina commented Apr 4, 2024

Hi, I’m not actively using this package at the moment so developing new features is on hold.
I’m happy to take PRs though!
I imagine something such as:

  • “use_bulk_create” keyword argument that defaults to “auto”
  • If “auto”, detect if model can use bulk create or not (multi table, maybe other conditions?)
  • If it can, use it. If it cannot, do single creates and log warning (that can be disabled by explcitly setting the option to False) - this makes it clear to caller about future performance hits
  • If True and bulk cannot be used, throw error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants