Reputation: 736
I am using PostgreSQL database for a program and came across the contains range (@>
) operator.
As I am converting a PostgreSQL query in python SQLAlchemy, therefore, I need to convert @>
into its SQLAlchemy equivalent.
Upvotes: 6
Views: 4851
Reputation: 736
I used op()
. The operator @>
is equivalent to "in" in python. But similar results could be achieved using .op('@>')
through SQLAlchemy. For example:
Places.query.filter(loc_amsterdam.op("@>")(loc_company))
Upvotes: 12