title: SQLAlchemy cast boolean column to int
body: <p>I have a table of user records and I wish to see the average when some condition is met. the condition column is a boolean.
  In Postgresql I could cast it easily:</p>
  
  <pre><code>select id, avg(cond::INT) from table group by id;
  </code></pre>
  
  <p>But in SQLAlchemy I couldn't find anything equivalent to <code>::INT</code>.<br>
  How do i deal with the type conversion?
  I have</p>
  
  <pre><code>orm_query(Table.id, func.avg(Table.cond))
  </code></pre>
  
  <p>which, of course, returns an error.</p>