I've two classes: Question and Answer. A question may have 0 or many
answers.
class Question(Base):
__tablename__ = "questions"
answers = relationship('Answer', backref='question',
primaryjoin="Question.id==Answer.question_id")
class Answer(Base):
__tablename__ = "answers"
Now I want to find all the questions have no answers, how to do it?
I tried:
Session.query(Question).filter('count(Question.answers)==0').all()
It is incorrect. What is the right one?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.