I am searching for the correct syntax for using server-side cursors when using the orm version (http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#creating-a-session) of sqlaclhemy.
E.g.
session = SessionMaker()
res = session.query(MyModel).filter(MyModel.date.between(odate, cdate))
for obj in res:
append_to_disk(obj)
I've tried:
stream_sessionmaker = sessionmaker(
pg_engine.connect().execution_options(stream_results=True)
)
session = stream_sessionmaker()
to no avail. The documentation seams to only document the Core version (http://docs.sqlalchemy.org/en/latest/core/tutorial.html) (http://docs.sqlalchemy.org/en/latest/core/connections.html#sqlalchemy.engine.Connection.execution_options.params.stream_results)