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'))
'개발 > 파이썬' 카테고리의 다른 글
Compute engine (우분투 18.04 LTS)에 파이썬 설치 (0) | 2020.12.31 |
---|---|
Flask-SQLAlchemy에서 secondaryjoin (0) | 2020.12.21 |
Python으로 http 서버 띄우기 (0) | 2020.12.16 |
파라메터를 정의하는 새로운 방법 (0) | 2020.12.07 |
Flask-restx와 webargs에서 TypeError 처리 (0) | 2020.12.07 |
댓글