#9519: Add QuerySet.bulk_delete() that issues only a single SQL query
-------------------------------------+-------------------------------------
Reporter: Tarken | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database, queryset, | Needs documentation: 0
delete | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by ptone):
Replying to [comment:17 akaariai]:
> The idea in comment:15 has been implemented - is there still need for
separate bulk_delete()?
I agree about ignoring cascades being a non-starter - if you need that
level of manipulation, drop to SQL.
The question is whether there are times you have a non-cascading model,
you have signals, but you want to just delete a batch of objects. This is
analogous to update method not firing signals.
whether this is bulk_delete or delete(signals=False) might be a minor
point, I'd lean slightly toward a separate method as being cleaner to
document as a special case, and to not introduce the concept of
signals=False as being something that people would request be a general
pattern for other methods.
If we wanted to offer some disabling signals more generally, perhaps we
could look into a context manager for that.
--
Ticket URL: <https://code.djangoproject.com/ticket/9519#comment:18>
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 https://groups.google.com/groups/opt_out.