The PGUuid doesn't accept Python's uuid.UUID type. Here's a simple patch 
to fix that:

diff --git 
a/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/databases/po
index 038a9e8..394c293 100755
--- 
a/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/databases/postgres.
+++ 
b/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/databases/postgres.
@@ -200,6 +200,17 @@ class PGBit(sqltypes.TypeEngine):
 class PGUuid(sqltypes.TypeEngine):
     def get_col_spec(self):
         return "UUID"
+
+    def bind_processor(self, dialect):
+        def process(value):
+            return str(value)
+        return process
+
+    def result_processor(self, dialect):
+        import uuid
+        def process(value):
+            return uuid.UUID(value)
+        return process

 class PGArray(sqltypes.MutableType, sqltypes.Concatenable, 
sqltypes.TypeEngine):
     def __init__(self, item_type, mutable=True):



Also, I wonder if we should make UUID type a generic type. Other 
databases can either store it as an integer or as a string of hex 
digits. There are db designers out there (like myself) who prefer UUIDs 
over numbers for IDs.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to