Di (pada saat penulisan ini mendatang) versi 1.4 Anda dapat menggunakan bindparam
yang diperluas dengan literal_execute=True
hanya untuk efek yang Anda cari:
In [2]: class Foo(Model):
...: id = Column(Integer, primary_key=True)
...: data = Column(Integer)
In [3]: metadata.create_all()
In [4]: session.query(Foo).\
...: filter(Foo.data.in_(
...: bindparam('xs', range(10), expanding=True, literal_execute=True))).\
...: all()
2019-09-07 20:35:04,560 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2019-09-07 20:35:04,561 INFO sqlalchemy.engine.base.Engine SELECT foo.id AS foo_id, foo.data AS foo_data
FROM foo
WHERE foo.data IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
2019-09-07 20:35:04,561 INFO sqlalchemy.engine.base.Engine ()
Out[4]: []