Hi all,

I've been having a little trouble configuring a relationship between 2
mapped classes where the join condition pulls in another 2 tables. I
eventually got it working based on Mike's "method one" from
http://stackoverflow.com/questions/17580649/sqlalchemy-relationships-across-multiple-tables,
by adding foreign() and remote() around a couple of columns involved
in the join.

However, I don't really understand what I'm doing, and probably as a
result of that, the relationship doesn't work in conjunction with
joinedload (one of the tables is missing from the FROM clause).

I can work up a proper example script, but before that I'd really like
to understand the effect that foreign() and remote() have when
constructing the relationship. The comment in the SO post says:

# B.id is "remote", well at the moment this is kind of
# where the ORM wants it, it sort of means "this is where the stuff
# starts that's not directly part of the A side"

In my situation, I've got tables A, B, C and D, with foreign keys:

A->B
B->D
C->A
C->D

and then extra constraints between B and C, and A and D, and I'm
trying to build a relationship from A to D. In all that, I've no real
idea where to put foreign() or remote().

Thanks for any advice,

Simon

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to