After looking more closely at the types bundled with SQLite, I changed
my code as follows:
class UUID(TypeDecorator):
impl = String
def __init__(self):
self.length = 36
def adapt(self, impltype):
return impltype(length=self.length)
def convert_bind_param(self, value, dialect):
if isinstance(value, uuid.UUID):
value = str(value)
elif isinstance(value, str):
value = str(uuid.UUID(value))
return super(UUID, self).convert_bind_param(value, dialect)
def convert_result_value(self, value, dialect):
return uuid.UUID(super(UUID, self).convert_result_value(value,
dialect))
...and all is well and right with the world. (For those watching from
the bleachers -- I'm now inheriting directly from TypeDecorator and
setting impl to String, rather than trying to inherit from String).
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users