postgresql - How do I compare Python list with Postgres Array in SQLAlchemy? -
i have column in psql table type array of type integers, let's call column tags
.i have python list has type integers, lets' call categories
.
how run sqlalchemy query return row in table if tags column has 1 or more matching integers categories array?
just use in_
documented here. in example
query.filter(user.name.in_(['ed', 'wendy', 'jack']))
the list ['ed, 'wendy', 'jack']
categories
, instead of user.name
use table , tags
column.
hope helps.
Comments
Post a Comment