I tried to write the following code assuming a User class with
first_name, last_name, and email:
search_term = Andrew
by_email = session.query(User.email.label(text),
User.email.label(email)).filter(User.email.like(%%%s%% %
search_term)
by_first_name = session.query(User.first_name.label(text),
that's an intricate trick which currently doesn't work with the ORM. #1852 is
added to see if there's a quick way to fix this (very likely there isn't
something quick).
You'd have to trick it using column(email) or something like that.
On Jul 13, 2010, at 3:02 PM, Andrew Bialecki wrote:
I
Any thoughts on a workaround?
On Tue, Jul 13, 2010 at 3:40 PM, Michael Bayer mike...@zzzcomputing.com wrote:
that's an intricate trick which currently doesn't work with the ORM. #1852
is added to see if there's a quick way to fix this (very likely there isn't
something quick).
You'd have
On 07/13/2010 02:43 PM, Andrew Bialecki wrote:
Any thoughts on a workaround?
Since you're selecting individual columns instead of mapped classes, the
ORM doesn't provide much benefit over straight SQL expressions. Try this
(untested):
by_email = select([User.email.label(text),