Re: [sqlalchemy] TypeDecorator to store bool as ENUM('N', 'Y')?

2013-08-16 Thread Jeff Dairiki
On Thu, Aug 15, 2013 at 12:21:43PM -0400, Michael Bayer wrote: On Aug 14, 2013, at 9:24 PM, Jeff Dairiki dair...@dairiki.org wrote: I'm working with an existing MySQL schema that has lots of columns of type ENUM('N', 'Y'). I'd like to deal with them as real booleans on the python side.

Re: [sqlalchemy] TypeDecorator to store bool as ENUM('N', 'Y')?

2013-08-16 Thread Michael Bayer
On Aug 16, 2013, at 9:40 AM, Jeff Dairiki dair...@dairiki.org wrote: Thank you for the quick response (as always), Mike. But I'm still fuddled. Okay, so I can customize how __invert__(), __and__() and __or__() (all the operations that evaluate their arguments in a boolean context) get

Re: [sqlalchemy] TypeDecorator to store bool as ENUM('N', 'Y')?

2013-08-15 Thread Michael Bayer
On Aug 14, 2013, at 9:24 PM, Jeff Dairiki dair...@dairiki.org wrote: I'm working with an existing MySQL schema that has lots of columns of type ENUM('N', 'Y'). I'd like to deal with them as real booleans on the python side. I have a simple TypeDecorator which almost works (I think):

[sqlalchemy] TypeDecorator to store bool as ENUM('N', 'Y')?

2013-08-14 Thread Jeff Dairiki
I'm working with an existing MySQL schema that has lots of columns of type ENUM('N', 'Y'). I'd like to deal with them as real booleans on the python side. I have a simple TypeDecorator which almost works (I think): class YNBoolean(sqlalchemy.types.TypeDecorator): impl =