#27639: Add a chunk size argument to QuerySet.iterator()
-------------------------------------+-------------------------------------
Reporter: François Freitag | Owner: François
| Freitag
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: cursors database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by François Freitag):
After reworking this PR to allow {{{chunk_size=None}}}, I'm not convinced
with {{{chunk_size=None}}}:
- It is introduced to workaround an issue with PostgreSQL, I do not
believe iterator should change for that reason.
- It's a PostgreSQL-only parameter, because server-side cursors cannot be
disabled on Oracle, and it'll be ignored on databases that don't support
server-side cursors.
- Its meaning is ambiguous. I would expect chunk_size=None to signify "do
not use chunked fetch and fetch all the results at once", i.e. use
{{{fetchall}}}. Django uses {{{fetchmany}}}.
- In most use cases I can think of, server-side cursors need to be either
globally enabled/disabled, not on a per-query basis. If a end-user really
want to do so, it's possible to setup an other connection and use
{{{using()}}} to disable server-side cursors for that query. I have a hard
time coming up with a use-case where third party libraries want to use
iterator, but not with a server-side cursor.
--
Ticket URL: <https://code.djangoproject.com/ticket/27639#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 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/073.5c2003ab377b7e1ffddad8431b4115f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.