from sqlalchemy import create_engine
engine = create_engine('postgresql://scott:tiger@localhost/test', echo=True)
with engine.connect() as conn:
    trans = conn.begin()
conn.execute('create table test (data integer)')
conn.execute('insert into test (data) values (%s)', [(1,), (2,), (3,), (4,),
    (5,)])
result = conn.execute('select * from test where data in %s', (((1, 2, 3),),))
print(result.fetchall())
Подстановка необработанных параметров SQL в SQLAlchemy с предложением IN