Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2662 closed enhancement (fixed)

[patch] dictfetchmany and dictfetchall should use generators

Reported by: Simon Willison Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In db.backends.util, dictfetchmany and dictfetchall currently use list comprehensions and will cause all rows to be loaded in to memory. Those functions should be generators, allowing rows to be loaded one at a time.

Attachments (1) (751 bytes) - added by Simon Willison 12 years ago.
Patch changing dictfetchmany and dictfetchall to be generators

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by Simon Willison

Attachment: added

Patch changing dictfetchmany and dictfetchall to be generators

comment:1 Changed 12 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [3783]) Fixed #2662 -- Changed dictfetchmany and dictfetchall to return iterators,
rather than a list, in order to save memory. Patch from Simon Willison.

Note: See TracTickets for help on using tickets.
Back to Top