8000 add bulk_create to QuerySet for batched inserts by asnelling · Pull Request #71 · encode/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add bulk_create to QuerySet for batched inserts #71

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

Closed
wants to merge 3 commits into from

Conversation

asnelling
Copy link

When you have an array of objects to put in the db, insert all of them at once in a single query:

entries = [
    Entry(headline='This is a test'),
    Entry(headline='This is only a test'),
]

# no return value; primary keys on object instances are not populated
Entry.objects.bulk_create(entries)

Inspired by Django's bulk_create. The batch_size and ignore_conflicts arguments are not implemented.

@asnelling asnelling changed the title add bulk_create to QuerySet for batched inserts #55 add bulk_create to QuerySet for batched inserts Jul 31, 2020
@asnelling
Copy link
Author

Resolves #55

@xloem xloem mentioned this pull request Aug 9, 2021
@aminalaee aminalaee closed this Nov 23, 2021
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

Successfully merging this pull request may close these issues.

2 participants
0