title: Convert rank and partition query to SqlAlchemy
body: <p>I would like to convert the following query to SqlAlchemy, but the documentation isn't very helpful:</p>
  
  <pre><code>select * from (
  select *, 
  RANK() OVER (PARTITION BY id ORDER BY date desc) AS RNK 
  from table1
  ) d
  where RNK = 1
  </code></pre>
  
  <p>Any suggestions?</p>