From 8e556b05e343fcac5dc762ab4251b15d84224652 Mon Sep 17 00:00:00 2001 From: Konsta Vesterinen Date: Tue, 21 Jan 2014 15:08:26 +0200 Subject: [PATCH] Add more complete example --- sqlalchemy_utils/aggregates.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sqlalchemy_utils/aggregates.py b/sqlalchemy_utils/aggregates.py index 8722037..2f71373 100644 --- a/sqlalchemy_utils/aggregates.py +++ b/sqlalchemy_utils/aggregates.py @@ -70,6 +70,15 @@ Simple aggregates thread_id = sa.Column(sa.Integer, sa.ForeignKey(Thread.id)) + thread = Thread(name=u'SQLAlchemy development') + thread.comments.append(Comment(u'Going good!')) + thread.comments.append(Comment(u'Great new features!')) + + session.add(thread) + session.commit() + + thread.comment_count # 2 + Custom aggregate expressions