I'm trying to match some names with the names I already have in my Postgresql database, using the following code:
last_like = '{last_name}%'.format(last_name)
matches = Session.query(MyTable).filter(or_(
MyTable.name.ilike(last_like),
MyTable.other_names.any(last_like, operator=ilike_op),
)).all()
Essentially it tries to match the name column or any of the other names stored as an array in the other_names column.
But I get:
KeyError: <function ilike_op at 0x7fb5269e2500>
What am I doing wrong?