title: SQLAlchemy: prevent automatic closing
body: <p>I need to insert/update bulk rows via SQLAlchemy. And get inserted rows.</p>
  
  <p>I tried to do it with session.execute: </p>
  
  <pre><code> &gt;&gt;&gt; posts = db.session.execute(Post.__table__.insert(), [{'title': 'dfghdfg', 'content': 'sdfgsdf', 'topic': topic}]*2)
   &gt;&gt;&gt; posts.fetchall()
  
   ResourceClosedError                       Traceback (most recent call last)
  </code></pre>
  
  <p>And with engine:</p>
  
  <pre><code>In [17]: conn = db.engine.connect()  
  
  In [18]: result = conn.execute(Post.__table__.insert(), [{'title': 'title', 'content':  'content', 'topic': topic}]*2)
  
  In [19]: print result.fetchall()
  ResourceClosedError: This result object does not return rows. It has been closed automatically.
  </code></pre>
  
  <p>The same response is an object has been closed automatically. How to prevent it?</p>