I think this might do what you want:
cond = or_(*[ Fruit.name.like('%' + term + '%') for term in terms ])
q = Session.query(Fruit).filter(cond)
-Kyle
>
> this would even be easier (and correcter if the terms contain "%")
> written as:
>
> cond = or_(*[Fruit.name.contains(term) for term in terms])
>
Indeed, good catch. I was so interested in the "apply or_" logic that I
missed the escaping bug :)
-Kyle