title: Python Flask sqlalchemy - sum columns by date
body: <p>I have the table</p>
  
  <pre><code>class NutritionConsumed(db.Model):
      __tablename__ = 'nutritionconsumed'
      id = db.Column(db.Integer, primary_key=True)
      date = db.Column(db.DateTime, nullable=False )
      calories = db.Column(db.Float, nullable=False)
      totalfat = db.Column(db.Float, nullable=False)
  </code></pre>
  
  <p>and I want to sum up the 'calories' and 'total fat' columns by 'date'</p>
  
  <p>so im trying</p>
  
  <pre><code>@app.route('/nutritiontotals')
  def nutritiontotals():
      nutritiontotals = NutritionConsumed.query.filter_by(func.sum(NutritionConsumed.calories), 
                                                          func.sum(NutritionConsumed.totalfat),
                                                          ).group_by(NutritionConsumed.date).all()
      return render_template('nutritiontotals.html', nutritiontotals=nutritiontotals)
  </code></pre>
  
  <p>but I get the error</p>
  
  <pre><code>TypeError: filter_by() takes 1 positional argument but 3 were given
  </code></pre>