Use .any():
session.query(Gizmo).filter(Gizmo.users.any('user1'))
On Wednesday, October 13, 2021 at 11:50:16 PM UTC+10 [email protected]
wrote:
> Imagine a Postgres JSON column with values like below:
> "["user1", "user2"]"
>
> Is there any way to query a postgres JSON (not JSONB) column with
> SqlAlchemy,like above that checks if the value "user1" is contained in this
> column?
>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/8ed928f8-e79c-4228-a5cc-942ce87f1a26n%40googlegroups.com.