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):
>        return case(self.statenum, statei2a)

Exactly what I needed, works like a charm - thank you so much!

For the archives - the args are flipped above.  Should be
"case(statei2a, self.statenum)".

Thanks,
Ross

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to