﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7596	Multiple Database Inserts using 1 query	ErikW	nobody	"It would be really nice (ie convenient, reduce load on db, improve performance) to be able to create a ""collection"" of model objects with a single query.  I've tested the raw SQL, and it is significantly faster than using a loop to insert a bunch of database rows.  All of the backends seem to support it.

I'm thinking something like
[queryset] = Model.objects.bulk_create([{object}, {object}, {object}])

http://www.desilva.biz/mysql/insert.html
http://www.postgresql.org/docs/8.2/interactive/sql-insert.html (search for: To insert multiple rows using the multirow VALUES syntax)
http://codingforums.com/archive/index.php?t-109802.html

Multirow inserts are not supported in sqlite yet (http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql), but the backend could fall back to a python loop in this case....

Thanks!
"	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed	database, create, multirow, feature	Trevor Caira Alexander Koshelev fnl sfllaw@… anssi.kaariainen@…	Accepted	1	0	0	0	0	0
