|
|
|
|
|
by blattimwind
2912 days ago
|
|
Yeah, I always considered that quite strange, given the order of the query (and even though forward references are found almost everywhere in SQL, making it even more strange) ORM-wise it's not a huge issue, I tend to move them outside the query definition to avoid the duplication. E.g. comment_count = func.count(Comment.id).label('comment_count')
query = (session.query(User, comment_count)
.join(User.comments)
.group_by(User)
.having(comment_count > 10))
|
|