Let\'s say I have a Postgres database (9.3) and there is a table called Resources. In the Resources table I have the fields id which is an
Resources
id
Also you could explicitly cast string to JSON (see Postgres JSON type doc).
from sqlalchemy.dialects.postgres import JSON from sqlalchemy.sql.expression import cast db_session.query(Resource).filter( Resources.data["lastname"] == cast("Doe", JSON) ).all()