title: Sqlalchemy get result as KeyedTuple instead of mapped objects
body: <p>Lets say you have a simple SQLAlchemy mapped object like this:</p>
  
  <pre><code>class User(Base):
      __tablename__ = 'users'
      id = sqlalchemy.Column(sqlalchemy.Integer, autoincrement=True,primary_key=True)
      name = sqlalchemy.Column(sqlalchemy.Unicode(255), unique=True, nullable=False)
      email = sqlalchemy.Column(sqlalchemy.Unicode(255), nullable=False)
      address = sqlalchemy.Column(sqlalchemy.Unicode(255), nullable=False)
  </code></pre>
  
  <p>Users are created:</p>
  
  <pre><code>sess.add(User(name=u'One', email=u'one@example.com', address='An address'))
  sess.add(User(name=u'Two', email=u'two@example.com', address='An address'))
  sess.add(User(name=u'Three', email=u'three@example.com', address='An address'))
  </code></pre>
  
  <p>Than you can query these three users with:</p>
  
  <p>1.)</p>
  
  <pre><code>sess.query(User).all()
  [&lt;__main__.User object at 0x2fb9790&gt;, &lt;__main__.User object at 0x2fb9810&gt;, &lt;__main__.User object at 0x2fb9890&gt;]
  </code></pre>
  
  <p>Which gives you a list of User objects.</p>
  
  <p>2.)</p>
  
  <pre><code>sess.query(User.id, User.name, User.email, User.address).all()
  [(1, u'one@example.com', u'An address'), (2, u'two@example.com', u'An address'), (3, u'three@example.com', u'An address')]
  </code></pre>
  
  <p>Which gives you a list of KeyedTuple objects where you can refer fields by attribute name like sess.query(User.id, User.name, User.email, User.address).all()[0].name</p>
  
  <p>3.)</p>
  
  <pre><code>sess.execute(sess.query(User)).fetchall()
  [(1, u'One', u'one@example.com', u'An address'), (2, u'Two', u'two@example.com', u'An address'), (3, u'Three', u'three@example.com', u'An address')]
  </code></pre>
  
  <p>Which gives you a list of RowProxy objects, where you can refer to fields like sess.execute(sess.query(User)).fetchall()[0]['users_name'].</p>
  
  <p>My question would be if there is an easy way to get the result of the second query example without having to list all the attributes of the user class or if there is a way to get the results of the third query with keys like 'name' instead of 'users_name', so the same as the attribute name in the User class.</p>
  
  <p>So basically what I would need is an object that contains all the column attributes of the User class and the attributes can be referred like res.name or res['name'].
  So I only need the attributes but not the whole User object with all the other stuff.</p>
  
  <p>This would make an iteration though the attributes very easy because you could say res.keys() for example.</p>
  
  <p>I hope my question is clear.
  I see that this is very similar to a User instance, but still not the same.</p>
  
  <p>The preferred solution would be the KeyedTuple as a result without having to explicitly list the attributes.</p>
  
  <p>Thanks in advance.</p>