title: How to use avg and sum in SQLAlchemy query
body: <p>I'm trying to return a totals/averages row from my dataset which contains the SUM of certain fields and the AVG of others.</p>
  
  <p>I could do this in SQL via:</p>
  
  <pre><code>SELECT SUM(field1) as SumFld, AVG(field2) as AvgFld 
  FROM Rating WHERE url=[url_string]
  </code></pre>
  
  <p>My attempt to translate this into SQLAlchemy is as follows:</p>
  
  <pre><code>totals = Rating.query(func.avg(Rating.field2)).filter(Rating.url==url_string.netloc)
  </code></pre>
  
  <p>But this is erroring out with: </p>
  
  <pre><code>TypeError: 'BaseQuery' object is not callable
  </code></pre>