Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Change the creation of columns to bulk add in sets of 100 to stop mem… #3

Open
wants to merge 1 commit into
base: v0.7.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ncdr/importers/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,10 @@ def load_file(fd, version):
link=link,
)
)
# batch create the columns in 100s
if len(columns) > 100:
Column.objects.bulk_create(columns)
columns = []

# create everything that's left
Column.objects.bulk_create(columns)