SQLAlchemy hybrid_property

I learned about hybrid_property in order to do some calculations directly on the database. In my brainstorming project, you can create a session where you add ideas. You can then add other users and rank ideas. I wanted to be able to automatically calculate the average scores. Below is an implementation of this.

from app import db
from sqlalchemy.ext.hybrid import hybrid_property

class Idea(db.Model):
    id = db.Column(db.Integer, nullable=False, primary_key=True)
    idea_session_id = db.Column(db.Integer, db.ForeignKey('idea_session.id'), nullable=False)
    name = db.Column(db.String, nullable=False)
    creator_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    scores = db.relationship("Score", backref='idea', cascade='delete', lazy='dynamic')

    @hybrid_property
    def avg_score(self):
        scores_for_idea = [score.score for score in self.scores]
        if len(scores_for_idea) == 0:
            return 0
        return sum(scores_for_idea)/float(len(scores_for_idea))

    def json_view(self):
        score_format = '%.1f' % self.avg_score
        return {"id": self.id, "session": self.idea_session_id, "name": self.name, "score": score_format}

class Score(db.Model):
    id = db.Column(db.Integer, nullable=False, primary_key=True)
    score = db.Column(db.Integer, nullable=False)
    idea_id = db.Column(db.Integer, db.ForeignKey('idea.id'), nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)