Re: (long) improving async support in psycopg

Federico Di Gregorio <fog-NGVKUo/i/[email protected]> Mon, 29 Mar 2010 09:37:05 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 24/03/2010 13:19, Jan UrbaƄski wrote:
> Yeah, to be honest the whole DBAPI 2.0 concept of connections and
> cursors is broken IMHO :( You do queries using cursors, but you commit
> using connections... when in fact you are always sending stuff over the
> same connection, so the "cursor" is just a layer of indiredction (until
> you do real standard SQL cursors, but then they behave very differently).

It is not broken. It is just that you _need_ cursors for some
programming patterns, like doing two selects and comparing results or
doing SELECT/UPDATE or SELECT/INSERT series. True, you can always cache
intermediate results in memory but why reinvent the wheel? A cursor is
exactly that, a lightweight cache for SELECT data and an handle to do
multiple INSERTs/UPDATEs in the same transaction.

federico (slowly catching up with email)

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
                   Ma chi sei?....-il trafficante di Nutella? -- Giorgia

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuwWKEACgkQvcCgrgZGjetGgwCghVkoM4eavvTOy/c1bvuVbHe3
CgwAnjCc5fB5xZH5zMO/c9j2kXClWhpF
=fhzW
-----END PGP SIGNATURE-----