On Sep 1, 2010, at 3:44 AM, Freewind wrote:
> I'm use sqlalchemy 0.6.4.
>
> I have 2 classes: Question and Tag, they are many-to-many.
>
> {{{
>
> class Question(Base):
> __tablename__ = "questions"
>
> id = Column(Integer, primary_key=True)
> deleted = Column(Boolean)
> ...
> tags = relationship('Tag', secondary=r_questions_tags)
>
> class Tag(Base):
> __tablename__ = "tags"
>
> id = Column(BigInteger, primary_key=True)
> questions = relationship('Question', secondary=r_questions_tags)
>
> }}}
>
> So, tag.questions will get all the questions belong to a tag.
>
> But now, since the Question has a deleted column, I hope to do like
> this:
>
> {{{
>
> class Tag(Base):
> ...
>
> # get non-deleted questions
> questions = relationship('Question', secondary=r_questions_tags,
> condition='Question.deleted==False')
> # get deleted questions
> deleted_questions = relationship('Question',
> secondary=r_questions_tags,
> condition='Question.deleted==True')
>
> }}}
>
> But unfortunately, there is no such condition parameter. What can I do
> now?
you would like to use "primaryjoin" and "secondaryjoin" here.
>
> --
> 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.
>
--
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.