I don't know of a way to do what you're asking. However, you could simply create your own constructor for MyDBLog which truncates the string if it is too long.
Barry ----- Original Message ---- From: Eoghan Murray <[EMAIL PROTECTED]> To: sqlalchemy <sqlalchemy@googlegroups.com> Sent: Thursday, September 11, 2008 7:21:39 AM Subject: [sqlalchemy] ProgrammingError and Catching an Exception Hi, I've the following which generates an insert: try: MyDBLog( myfield='A too long string xxxxxxxxxxxx' ) except Exception, e: log.error("Exception occurred with database logging: %s" % e) Unfortunately, 'myfield' is (for example) a string of only length 10, so the session fails with ProgrammingError: (ProgrammingError) value too long for type character varying(10) This error occurs at session commit time, so my 'except' clause above is useless. As 'MyDBLog' is not critical, I want to be able to ignore/log any kind of Exception which the 'try' block above ultimately generates. Is there a way to do this? Thanks! Eoghan --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---