title: sqlalchemy - grouping items and iterating over the sub-lists
body: <p>Consider a table like this:</p>
  
  <pre><code>| Name       | Version | Other |
  | ---------------------|-------|
  | Foo        | 1       | 'a'   |
  | Foo        | 2       | 'b'   |
  | Bar        | 5       | 'c'   |
  | Baz        | 3       | 'd'   |
  | Baz        | 4       | 'e'   |
  | Baz        | 5       | 'f'   |
  --------------------------------
  </code></pre>
  
  <p>I would like to write a sqlalchemy query statement to list all items (as mapper objects, not just the Name column) with max version: <code>Foo-2-b, Bar-5-c, Baz-5-f</code>. I understand that I would have to use the <code>group_by</code> method, but beyond that I am puzzled as to how to retrieve the sub-lists (and then find the max element). SQLAlchemy documentation is apparently not very clear on this.</p>
  
  <p>In the real scenario, there are many other columns (like 'Other') - which is why I need the actual row object (mapper class) to be returned rather than just the 'Name' value.</p>