title: selecting whole entities from SQLAlchemy subqueries
body: <p>If I specify mapped classes (~= database tables) in a SQLAlchemy query, then the returned rows will contain instances of those classes:</p>
  
  <pre><code>q = sess.query(table1, table2, table3.string_column)
  q.first()
  ==&gt; ( &lt;instance of table1&gt;,
        &lt;instance of table2&gt;,
        'string' )
  </code></pre>
  
  <p>However, if I select from a subquery, then the returned rows contain the individual columns rather than the class instances:</p>
  
  <pre><code>q = sess.query(table1, table2, table3.string_column)
  
  q2 = sess.query( q.subquery() )
  q2.first()
  ==&gt; ( col1_of_table1, col2_of_table1, ...,
        col2_of_table2, col2_of_table2, ...,
        'string' )
  </code></pre>
  
  <p>Is there a way to specify that I want to preserve the row from the subquery as an instance of a mapped class?</p>
  
  <p>I can't figure out how to do this without joining to a new instance of the mapped classes. The <a href="http://docs.sqlalchemy.org/en/rel_0_9/core/selectable.html#sqlalchemy.sql.expression.Alias.corresponding_column" rel="noreferrer"><code>corresponding_column</code></a> method allows me to refer to specific <strong>columns</strong> from the subquery, but I can't figure out how to refer to complete entities from the subquery. I've tried playing around with <a href="http://docs.sqlalchemy.org/en/rel_0_7/core/expression_api.html#sqlalchemy.sql.expression.Select.select_from" rel="noreferrer"><code>select_from</code></a> but it doesn't give me the right behavior.</p>
  
  <p>Any suggestions?</p>