How to do a 'select like' usinf sqlalchemy?

1,473 views
Skip to first unread message

vrs762

unread,
Oct 6, 2007, 5:35:55 AM10/6/07
to TurboGears
In sql syntax one can do select * from table where attribute like
'%value%'

However, how would one do that using the sqlalchemy's get/get_by
methods?

I tried different combinations but got only syntax errors.

Thanks in advance.

Werner F. Bruhin

unread,
Oct 6, 2007, 5:43:42 AM10/6/07
to turbo...@googlegroups.com
Hi,

Just starting with SA, but what about something along these lines:

session.query(User).filter(User.name.like('%ed'))

or

session.query(User).filter_by(name='ed', fullname='Ed Jones')

Werner

Reply all
Reply to author
Forward
0 new messages