On 14/10/11 12:32, thomas veymont wrote:
> I guess I'm doing it the wrong way. There's a doc in psycopg
> about named cursors but I don't understand exactly how I should
> follow it to tie to my problem. (that is : using my existing pgpsql function
> that returns a cursor, then iterate on that cursor).
> any suggestion ?
Yes, use the native support for server-side cursors in psycopg. First,
don't use a procedure to setup the cursor but just pass to execute()
curs = conn.cursor("mycursor")
curs.execute("SELECT col FROM test")
curs.fetchmany(10) # fetch 10 rows from the cursor
hipe this helps,
Federico Di Gregorio fog(at)initd(dot)org
When people say things are a lot more complicated than that, they
means they're getting worried that they won't like the truth.
-- Granny Weatherwax
In response to
psycopg by date
|Next:||From: Daniele Varrazzo||Date: 2011-10-14 12:07:42|
|Subject: Re: using server side cursor|
|Previous:||From: thomas veymont||Date: 2011-10-14 10:32:03|
|Subject: using server side cursor|