title: SqlAlchemy closure in subquery
body: <p>I have searched many topics and didn't find the answer, or question was too complex. So okay. This is my first question. 
  Here is the SQL</p>
  
  <pre><code>SELECT  parent.*,
  (
      SELECT  COUNT(*)
      FROM    child
      WHERE   parent.id = child.parent_id
  )
  FROM parent
  </code></pre>
  
  <p>How to do this clause in sqlalchemy?</p>
  
  <pre><code>WHERE   ui.invited_by = u.id
  </code></pre>
  
  <p>Can it be reproduced in collections ? sql expressions ? 
  P.S. I know that it can be done by group_by. But i need by subquery.</p>
  
  <p>Thank you.</p>