[sqlalchemy] Simple one-to-one translation with hybrid_attribute

2011-08-01 Thread Ross Vandegrift
Hello everyone, Trying to use hybrid_attribute to provide friendly names for integers representing object states. Storage and retrieval works fine, but I can't get filtering working. I want the translation to happen on the Python side prior to filling in the query parameters, but

Re: [sqlalchemy] Simple one-to-one translation with hybrid_attribute

2011-08-01 Thread Michael Bayer
On Aug 1, 2011, at 5:08 PM, Ross Vandegrift wrote: Hello everyone, Trying to use hybrid_attribute to provide friendly names for integers representing object states. Storage and retrieval works fine, but I can't get filtering working. I want the translation to happen on the Python side

Re: [sqlalchemy] Simple one-to-one translation with hybrid_attribute

2011-08-01 Thread Ross Vandegrift
On Mon, 2011-08-01 at 17:22 -0400, Michael Bayer wrote: You're looking to convert from int-string using a mapping in a SQL expression, so I think you'd need to write @state.expression as a CASE statement. from sqlalchemy import case @state.expression def state(self):