Hi SQLAlchemy experts out there, here's a tricky one for you:
I'm trying to write a query that resolves into something like:
SELECT * FROM MyTable where my_column LIKE ANY (array['a%', 'b%'])
using SQLAlchemy:
foo = ['a%', 'b%']
# this works, but is dirty and silly
DBSession().query(MyTable).filter("my_column LIKE ANY (array[" + ", ".join(["'" + f + "'" for f in token.tree_filters]) + "])")
# something like this should work (according to documentation), but doesn't (throws "AttributeError: Neither 'AnnotatedColumn' object nor 'Comparator' object has an attribute 'any'"
DBSession().query(MyTable).filter(MyTable.my_column.any(foo, operator=operators.like)
Any solutions?