psycopg2 and large queries

alito alitosis at
Fri Dec 19 02:53:46 CET 2008

On Dec 19, 2:34 am, Laszlo Nagy <gand... at> wrote:
> I was looking for psycopg2 documentation, but I found nothing. However,
> I found some posts telling that named cursors do support fetching a
> single row at a time. Here is how to create a named cursor:
> cur = conn.cursor('mycursor')
> This is very strange, because DB API 2.0 does not have this feature. Why
> this feature was created, and how to use it? Not documented.
The feature was created to use server-side cursors.  The DB API
doesn't specify how to create them.  I've got no idea why it isn't

> However, this is also not usable, because named cursors do not have a
> ".description" property! You can try this:
> cur = conn.cursor('mycursor')
> cur.execute('select name from product limit 1000000')
> print repr(cur.description)  # -> None

They do have a description attribute, but it is only populated after
you fetch a row.  eg try
cur = conn.cursor(name='mycursor')
cur.execute('select name from blah')
print cur.description

> This is unacceptable!

Really?  I accepted it just fine.

> p.s.: I tried to subscribe to the psycopg mailing list, but the
> confirmation email did not arrive in 6 hours...

psycopg website and development in general seems to be comatose.
Emails to the list are being silently dropped. Also, don't believe the
front page, development stopped happening on that svn branch a while
ago and moved to a bzr branch, which has failed to respond for the
last few weeks.  Maybe the relevant people are on holidays.  If this
persists for a while someone will fork it, since quite a few people
are interested in its continued development.

More information about the Python-list mailing list