Question
I'm trying to do this query in SQLAlchemy:
I would like to bind the list [123,456] at execution time.
How-To
How about session.query(MyUserClass).filter(MyUserClass.id.in_((123,456))).all() ?
- session.execute(
- select(
- [MyUserTable.c.id, MyUserTable.c.name],
- MyUserTable.c.id.in_((123, 456))
- )
- ).fetchall()
沒有留言:
張貼留言