Opened 7 years ago

Closed 6 months ago

Last modified 6 months ago

#48 closed defect (fixed)

Add methods returning interator of rows to the classic module

Reported by: cito Owned by: D'Arcy J.M. Cain
Priority: major Milestone: 4.2
Component: DB API 2 Version: 4.0
Keywords: Cc:

Description (last modified by cito)

Add new methods in the classic module, similar to getresult(), dictresult() and namedresult(), but returning iterators of rows instead of lists of rows.

Or instead of adding new methods, add a boolean flag to the existing methods (see also #23).

One problem here is that PQExec always reads the whole result into memory anyway, so using it would thwart the idea of saving memory by using an iterator. We probably need to create a cursor behind the scenes for this to make sense (see also #68).

See also #67 (add methods for returning scalar values) in this context.

Change History (4)

comment:1 Changed 4 years ago by cito

Description: modified (diff)

comment:3 Changed 4 years ago by cito

Description: modified (diff)

comment:4 Changed 6 months ago by cito

This has now been implemented in r978 and will be released with PyGreSQL 5.1.

The Query object can now be used as an iterator yielding tuples like getresult(). Methods dictiter() and namediter() have been added as weill, which yield dicts and named tuples.

comment:5 Changed 6 months ago by cito

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.