wiki:SqlObjectGotchas
Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 3 (modified by nerkles, 13 years ago) (diff)

added stuff about PickleCol? and length

SqlObject? does not catch and re-throw the exceptions of the underlying DB-API module. Instead you will get the exceptions of the DB-API module directly in your face, like an IntegrityError if you hit a constraint violation.

I haven't seen a sensible way to intercept those exceptions, yet, something like

try:
   ...
except hub.hub.getConnection().module.IntegrityError, e:
   ...

just seems to be too kludgy ...

Question: Maybe this is a bug in SQLObject?

Using PickleCol? and MySQL

    some_field = PickleCol()

Will create a TINYBLOB column in MySQL, which can only hold 256 bytes. Depending on the data you're throwing at it, this may be OK, but if you start getting "Pickle data truncated" errors, add a length to the PickleCol?, like so:

    some_field = PickleCol( length=2**24 )

This will give you more room to pickle stuff.

Check the MySQL docs to see what length values will map to MEDIUMBLOB and LARGEBLOB, if you need to be precise.