django / django/new-features

Faster bulk_create using dictionaries

Open
#113 1 comment 13 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Feature Description

Allow `QuerySet.bulk_create` to accept dictionaries in addition to model instances. This would be symmetrical to `QuerySet.values`.

### Problem

Creating model instances is expensive and significantly slows down bulk-inserting data. By using dictionaries, we can avoid this bottleneck.

### Request or proposal

proposal

### Additional Details

[Forum discussion](https://forum.djangoproject.com/t/faster-bulk-create-using-dictionaries/43891)

### Implementation Suggestions

As linked in the forum, here's a tentative implementation that I prepared: https://github.com/adamsol/django/commit/ed1ad9c1e53a6ac23df2474f71bd997401dfc93c. It would mostly require tests.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.