Re: psycopg2 adaptation for UUIDs

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <[email protected]>
Il giorno mar, 16/09/2008 alle 10.51 +0200, Brian Sutherland ha scritto:
> Seeing as both PostgreSQL 8.3 and python 2.5 support the UUID data type,
> I thought it might be a good feature if psycopg2 supported them natively
> as well. (don't know what project policy is on this)
> 
> This is the code I am using to be able to put UUID object into and get
> them out of PostgreSQL:

Starting from your code I added UUID support in psycopg2 (pushed to bzr
trunk right now). Just:

import psycopg2.extras
psycopg2.extras.register_uuid()

Note that register_uuid() takes an optional OID parameter for
non-standard installations where the OID value of the PosgreSQL uuid
type is not 2950. register_uuid() will raise an exception if Python uuid
module is not available.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
       Se sai che hai un ***** di file così, lo manovri subito. -- vodka

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkjT/TMACgkQvcCgrgZGjetPSACgyEsMZUt/VzwzXr1G2/QQhTV6
bsYAnipr3tIYGNZ+BOam/TOR71SLKoYh
=IArs
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.