On 11/2/09 14:04 , Sir Rawlins wrote:
>
> Hello Guys,
>
> I'm getting an exception thrown when trying to save an entity into a
> SQLite database, this is a database/app which has been ported over
> from a MySQL backend.
>
> The exception looks like this:
>
> InterfaceError: (InterfaceError) Error binding parameter 0 - probably
> unsupported type. u'INSERT INTO bluetooth_session
> (bluetooth_session_id, result, address, message_id, campaign_id,
> created, modified) VALUES (?, ?, ?, ?, ?, ?, ?)' [UUID
> ('ed6ce6a6-4918-421e-9fa5-b41972931713'), dbus.String
> (u'org.openobex.Error.LinkError'), dbus.String(u'00:1F:6B:58:4A:F5'),
> 1686, 274, '2009-11-02 12:59:03.521275', '2009-11-02 12:59:03.521275']
> )
>
> Now, my first instincts tell me that the issue here is probably the
> UUID which I'm using as the PK for the table, the column datatype is
> set to varchar(50) and the definition in the mapper for the class
> looks like this:
>
> bluetooth_session_id = Column(String, primary_key=True,
> default=uuid.uuid4)
>
> Now, do I have to make a change somewhere here? do I perhaps have to
> change that default statement somehow to format the UUID object as a
> string?

Try this:

     bluetooth_session_id = Column(String, primary_key=True,
          default = lambda: str(uuid.uuid4()))

Wichert.

--~--~---------~--~----~------------~-------~--~----~
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