Re: psycopg2 and large queries

2008-12-18 Thread Laszlo Nagy
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') cur.fetchone() print cur.description Oh, great. I should have known. Thanks. Maybe I can live with psycopg2, because combining

Re: psycopg2 and large queries

2008-12-18 Thread alito
On Dec 19, 2:34 am, Laszlo Nagy 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

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 22:28, Laszlo Nagy wrote: > > I'm just looking for something that can replace psycopg2, because of the > bug mentioned in my original post. Here are my options: > > - psycopg1: development stalled > - psycopg2: memory bug and/or not db api compilant (see my original post) If you want,

Re: psycopg2 and large queries

2008-12-18 Thread M.-A. Lemburg
On 2008-12-18 22:28, Laszlo Nagy wrote: > >> Well, there are plenty of PostgreSQL modules around these days, and >> even if pyPgSQL isn't suitable, I'm sure that there must be one which >> can be made to work on Windows and to support server-side cursors. See >> here for more: >> >> http://wiki.py

Re: psycopg2 and large queries

2008-12-18 Thread D'Arcy J.M. Cain
On Thu, 18 Dec 2008 22:28:23 +0100 Laszlo Nagy wrote: > - PyGresSQL: apparently, it does not support fetching one row, only > fetching all rows (see: > http://www.pygresql.org/pg.html#getresult-get-query-values-as-list-of-tuples), > > so this is not an option. (Yes, it also has a db api compil

Re: psycopg2 and large queries

2008-12-18 Thread Laszlo Nagy
Well, there are plenty of PostgreSQL modules around these days, and even if pyPgSQL isn't suitable, I'm sure that there must be one which can be made to work on Windows and to support server-side cursors. See here for more: http://wiki.python.org/moin/PostgreSQL I'm just looking for somethin

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 19:09, Steve Holden wrote: > > Hmm, pypgsql doesn't provide a 2.5 Windows installer. I take it you > aren't a Windows user ... ? Well, there are plenty of PostgreSQL modules around these days, and even if pyPgSQL isn't suitable, I'm sure that there must be one which can be made to work

Re: psycopg2 and large queries

2008-12-18 Thread Steve Holden
Paul Boddie wrote: [...]> > You really don't want to be traversing large data sets using fetchone, > anyway. My approach (using pyPgSQL) involves fetchmany and then > looping over each batch of results, if I really have to process the > data in Python; most of the time I can do the processing in t

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 16:34, Laszlo Nagy wrote: > psycopg2 is said to be db api 2.0 compilant, but apparent it is buggy. > By default, when I create a cursor with > > cur = conn.cursor() > > then it creates a cursor that will fetch all rows into memory, even if > you call cur.fetchone() on it. (I tested it,