title: SQLAlchemy select distinct
body: <p>I have the following code:</p>
  
  <pre><code>    session = Session()
      query = session.query('count').from_statement(
          """
              SELECT COUNT(DISTINCT autoresponder.campaign_id) as count
              FROM autoresponder
              WHERE autoresponder.account_id=:account_id AND autoresponder.is_active='t'
          """
      ).params(account_id=account_id).all()
  
      print query[0].count
  </code></pre>
  
  <p>But I am trying to understand SQLAlchemy better and want to transform the above SQL statement into a SQLAlchemy ORM object that just returns the a count of distinct rows.</p>