mecio
mecio

Reputation: 263

ORM query with or statement

I am trying to query users by list of id using in statement http://www.w3schools.com/sql/sql_in.asp

It is possible to do it without string query and execute function?

I am looking for something like below

users = User.query.filter_by(id=[1,5,12,4])

Upvotes: 0

Views: 125

Answers (1)

Martin Maillard
Martin Maillard

Reputation: 2811

Did you try User.query.filter(User.id.in_([1, 5, 12, 4])) ?

Upvotes: 4

Related Questions