title: SQLAlchemy - loading user by username
body: <p>Just diving into pylons here, and am trying to get my head around the basics of SQLALchemy.  I have figured out how to load a record by id:</p>
  
  <pre><code>user_q = session.query(model.User)
  user = user_q.get(user_id)
  </code></pre>
  
  <p>But how do I query by a specific field (i.e. username)?  I assume there is a quick way to do it with the model rather than hand-building the query.  I think it has something with the <code>add_column()</code> function on the query object, but I can't quite figure out how to use it.  I've been trying stuff like this, but obviously it doesn't work:</p>
  
  <pre><code>user_q = meta.Session.query(model.User).add_column('username'=user_name)
  user = user_q.get()
  </code></pre>