Re: using server side cursor

From: Federico Di Gregorio <fog(at)dndg(dot)it>
To: thomas veymont <thomas(dot)veymont(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: using server side cursor
Date: 2011-10-14 13:41:42
Message-ID: 4E983C16.9080203@dndg.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 14/10/11 15:22, thomas veymont wrote:
> thanks for your helpful answers.
>
>>> >> mycursor.execute ( "fetch mycursor" )
> is working okay.
>
> you are right : using the psycopg native support for cursors makes
> clearer code. But, yes indeed, the pgsql function is somewhat a
> mandatory API to the database, so the Python code doesn't have to know
> the inner query structure.
>
> Daniele, beside the hack you are providing, you say : "all cursors
> from the same connections live in the same transaction"
> => is it something specific that is true today but may change in the
> future ? I mean, may I rely on this for a long-living code ?

Yes. Cursors are (and always be, we care about forward compatibility)
WITHOUT HOLD, so they live inside the current transaction only (unless
you pass the withhold parameter, that's it.)

federico

--
Federico Di Gregorio fog(at)initd(dot)org
Ahr ahr ahr! E mo' me'e magno tutte! -- Er bieco

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2011-10-14 13:44:29 Re: using server side cursor
Previous Message thomas veymont 2011-10-14 13:22:23 Re: using server side cursor