QLAlchemy1 Flask-SQLAlchemy의 Column에 subquery 사용 class Question(db.Model): ... answer_count = db.column_property(db.select([db.func.count(db.text('qid'))]) .select_from(db.text('answer')) .where(db.text('qid == question.id')) .correlate_except(db.text('answer')) .label('answer_count')) 2020. 12. 21. 이전 1 다음