[sqlalchemy] Replacing a single column in a select (Core language)

2014-03-27 Thread Josh Kuhn
I have a situation where I need to produce a select object, and then later, one of the fields needs to be zeroed out conditionally. so something like: def select_ab(param): from_obj = join(A, B, A.c.b == B.c.b) return select([A.c.a, B.c.b, B.c.d], from_obj=from_obj).where(A.c.a == param)

Re: [sqlalchemy] Replacing a single column in a select (Core language)

2014-03-27 Thread Michael Bayer
On Mar 27, 2014, at 10:08 AM, Josh Kuhn deontologic...@gmail.com wrote: I have a situation where I need to produce a select object, and then later, one of the fields needs to be zeroed out conditionally. so something like: def select_ab(param): from_obj = join(A, B, A.c.b == B.c.b)

Re: [sqlalchemy] Replacing a single column in a select (Core language)

2014-03-27 Thread Josh Kuhn
That works great. My one stumbling block was that the column objects couldn't be compared directly, so I compared their string representation (I had two separate calls to A.alias() which made `is` not a valid comparison in the comprehension) On Thu, Mar 27, 2014 at 11:49 AM, Michael Bayer