Hi there,
I'm exploring the bidirectional adjacency list pattern described in
the documentation (the scalar relationship is intentional):
Person.child = relationship(
Person,
uselist=False,
backref=backref('parent', remote_side=Person.id)
)
However, I'd like to add an additional primaryjoin condition,
something to the effect of:
child = aliased(Person)
Person.child_bob = relationship(
child,
uselist=False,
primaryjoin=and_(
child.parent_id == Person.id,
child.name == 'Bob'
),
backref=backref('parent', remote_side=Person.id)
)
But of course I can't use an AliasedClass in the first argument to
relationship(). Similarly I can't add the relationship property onto
an aliased parent class. What's the proper way of defining such a
relationship?
--
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.