KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to return a totals/averages row from my dataset which contains the SUM of certain fields and the AVG of others. I could do this in SQL via: SELECT SUM(field1) as SumFld, AVG(field2) as AvgFld FROM Rating WHERE url=[url_string] My attempt to translate this into SQLAlchemy is as follows: totals = Rating.query(func.avg(Rating.field2)).filter(Rating.url==url_string.netloc) But this is erroring out with: TypeError: 'BaseQuery' object is not callable
Tags (comma-separated)
Save Edits
Cancel