Re: using server side cursor - Mailing list psycopg

From Daniele Varrazzo
Subject Re: using server side cursor
Date
Msg-id CA+mi_8YtcXc235ZC9rHz4X5tGWM2B-WurBtxo5mdA+9AcoXKgQ@mail.gmail.com
Whole thread Raw
In response to using server side cursor  (thomas veymont <thomas.veymont@gmail.com>)
List psycopg
On Fri, Oct 14, 2011 at 11:32 AM, thomas veymont
<thomas.veymont@gmail.com> wrote:

> mycursor.execute ( "fetch", [ "mycursor" ] ) # fetch row from this cursor
> mycursor.fetchone()

This is the only error you have made: there is no placeholder in the
query. And even if there was, it would be an error as it would result
in something like "fetch 'mycursor' ", and postgres doesn't want the
quotes.

mycursor.execute ( "fetch mycursor" ) would do what you were
expecting. If you have to compose the command, you have no protection
though, so you should be hypercareful about where "mycursor" comes
from.

Federico is right though that using the plain query with a psycopg
named cursor makes things easier.

-- Daniele

psycopg by date:

Previous
From: Federico Di Gregorio
Date:
Subject: Re: using server side cursor
Next
From: Daniele Varrazzo
Date:
Subject: Re: using server side cursor