title: SQLAlchemy, get object not bound to a Session
body: <p>I am trying to get an collection of objects out of a database and pass it to another process that is not connected to the database.  My code looks like the one below but I keep getting:</p>
  
  <pre><code>sqlalchemy.exc.UnboundExecutionError: Instance &lt;MyClass at 0x8db7fec&gt; is not bound to a Session; attribute refresh operation cannot proceed
  </code></pre>
  
  <p>When I try to look at the elements of my list outside of the <code>get_list()</code> method.</p>
  
  <pre><code>def get_list (obj):
      sesson = Session()
      lst = session.query(MyClass).all()
      session.close()
      return lst
  </code></pre>
  
  <p>However, if I use this:</p>
  
  <pre><code>def get_list_bis (obj)
      session = Session()
      return session.query(MyClass).all()
  </code></pre>
  
  <p>I am able to use the elements but worry about the state of the session since it was not closed.  </p>
  
  <p>What am I missing here?</p>