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