[sqlalchemy] Re: SqlAlchemy with Postgres: How can I make a query that checks if a string is in a list inside a json column

2021-10-13 Thread Sergey V.
Use .any(): session.query(Gizmo).filter(Gizmo.users.any('user1')) On Wednesday, October 13, 2021 at 11:50:16 PM UTC+10 chat...@gmail.com wrote: > Imagine a Postgres JSON column with values like below: > "["user1", "user2"]" > > Is there any way to query a postgres JSON (not JSONB) column

[sqlalchemy] SqlAlchemy with Postgres: How can I make a query that checks if a string is in a list inside a json column

2021-10-13 Thread chat...@gmail.com
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