Re: using server side cursor
От | Federico Di Gregorio |
---|---|
Тема | Re: using server side cursor |
Дата | |
Msg-id | 4E981FEA.6010702@dndg.it обсуждение исходный текст |
Ответ на | using server side cursor (thomas veymont <thomas.veymont@gmail.com>) |
Ответы |
Re: using server side cursor
|
Список | psycopg |
On 14/10/11 12:32, thomas veymont wrote: [snip] > 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() your SQL: curs = conn.cursor("mycursor") curs.execute("SELECT col FROM test") curs.fetchmany(10) # fetch 10 rows from the cursor hipe this helps, federico -- Federico Di Gregorio fog@initd.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
В списке psycopg по дате отправления: