#7596: Multiple Database Inserts using 1 query
-------------------------------------+-------------------------------------
Reporter: erikcw | Owner: nobody
Type: New | Status: new
feature | Component: Database layer
Milestone: | (models, ORM)
Version: SVN | Severity: Normal
Resolution: | Keywords: database, create,
Triage Stage: Accepted | multirow, feature
Needs documentation: 0 | Has patch: 1
Patch needs improvement: 0 | Needs tests: 0
UI/UX: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by akaariai):
* cc: anssi.kaariainen@… (added)
Comment:
Some notes on the approach.
Combining instances with and without autoincrement primary keys set, use
this sql:
{{{
insert into table_with_serial_id(id, other_col) values(1,
'foo'),(default, 'bar');
}}}
A different question is if this is something that needs to be supported at
all. I don't see it particularly useful to insert anything else than
default values into serial columns. Except for bulk loading, but then you
don't want to have None values in the mix. Maybe there is an use case?
Also, why doesn't the code use "RETURNING serial_pk" where available?
Maybe that would make the situation more confusing, because sometimes the
bulk_save method would include the PKs and sometimes not depending on used
backend. Maybe a kwarg 'returning_autopk' and if that is set then raise
error if the backend doesn't support RETURNING?
--
Ticket URL: <https://code.djangoproject.com/ticket/7596#comment:16>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.