postgresql - SQLAlchemy: Querying compound primary key with `IN` operator -


assuming table foo compound primary key (a,b), how can generate following sql query sqlalchemy (postgresql dialect)?

select * foo (a,b) in ((1,2), (2,3)); 

here answer:

from sqlalchemy.sql.expression import tuple session.query(foo).filter(tuple(foo.a, foo.b).in_([(1,2), (3,4)])).all() 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -