#26530: Batch operations on large querysets
-------------------------------------+-------------------------------------
               Reporter:  mjtamlyn   |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  master
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 It's a pretty common requirement to need to perform an operation on all
 elements of a large queryset - especially in data migrations where you may
 not be able to express the updates needed purely as an `update` call or
 similar.

 It would be very handy to have a batching operation, something like
 `Queryset.batch(lambda obj: obj.do_something(), batch_size=100)`. This
 would page through the queryset in memory, performing the lambda on every
 object. Naming is obviously up for discussion. I must have code to do
 something like this dozens of times.

 This is quite similar to how a Paginator works, but the API for pagination
 feels a bit funny for doing this and it's not much less code than writing
 it yourself.

--
Ticket URL: <https://code.djangoproject.com/ticket/26530>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.cc06d02233ac6f9732196b0cafe7ac12%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to