I've been battling with a particular relationship and eventually managed to
get it working based off the docs when I realized I had a similar way to
short-circuit the chain, however I'm not happy with the result.
(https://gist.github.com/jvanasco/6a98b339771bdee38e5d77b0da6ffd98)
My unhappiness is that I had to use the `foreign()`construct simply because
I couldn't figure out how to do a join:
cs = relationship("C", secondary= "join(A2B, C, A2B.b_id == C.b_id)"
,primaryjoin="and_(A.id == A2B.a_id)"
,secondaryjoin="C.b_id == foreign(A2B.b_id)",
)
I was hoping to avoid the `foreign` and somehow do a straight join of:
A.id == A2B.a_id,
A2B.id == B.id,
B.id == C.b_id
This query does what I want and is probably faster, I just have no idea how
to do things the other way.
Does anyone have deeper insight? I spent about 2 hours on the docs trying
to really understand this section, and every time I thought I understood --
I didn't.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.