[DB-SIG] New take on PostgreSQL bindings for Python

Federico Di Gregorio fog at initd.org
Wed Sep 6 00:37:56 CEST 2006


Il giorno mar, 05/09/2006 alle 17.39 -0400, Cristian Gafton ha scritto:
> - server side cursors. Currently, most bindings for most databases have to 
> decide what to do after an cursor.execute() call - do they automatically 
> retrieve all the resulting rows in the client's memory, or do they 
> retrieve it row by row, pinging the server before every retrieval to get 
> more data (hey, not everybody using Oracle ;^). DB API has no support 
> for controlling this in a consistent fashion, even though Python has 
> solved the issue of dict.items() vs dict.iteritems() a long time ago. 
> The application writers should have a choice on how the cursors will 
> behave. 

Sure. psycopg 2 uses a little extension to the dbapi and adds to
cursor() an extra parameter: "name". If a cursor is named then a server
side cursor with that name is automatically generated (and destroyed at
the end of the current transaction) else, if name is None, a normal
cursor is created. Then fetchXXX() methods do the right thing without
the need to introduce extra methods.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                fog at debian.org
INIT.D Developer                                           fog at initd.org
                      Sei una bergogna. Vergonga. Vergogna. -- Valentina
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa =?ISO-8859-1?Q?=E8?= una parte del messaggio
	firmata digitalmente
Url : http://mail.python.org/pipermail/db-sig/attachments/20060906/2fdbf89f/attachment.pgp 


More information about the DB-SIG mailing list