On Aug 11, 2011, at 6:45 PM, neurino wrote:

> Sorry if I bother again but adding some others relationships like this 
> spanning on 5 tables:
> 
>     mapper(UserLayer, inherits=base_user_layer_mapper,
>         polymorphic_identity=CLASS_LAYER,
>         properties={
>             ...
>             'lca_transport': relationship(LCATransport,
>                 primaryjoin=and_(
>                     user_layers.c.id_mat==lca_transport.c.id_mat,
>                     user_layers.c.id_user_str==user_stratigraphies.c.id,
>                     user_stratigraphies.c.id_prov==provinces.c.id,
>                     provinces.c.id_reg==regions.c.id,
>                     regions.c.id_mr==lca_transport.c.id_mr),
>                 foreign_keys=(user_layers.c.id_mat,
>                     user_layers.c.id_user_str)),
>     })


if you take a look at 
http://www.sqlalchemy.org/trac/attachment/ticket/2255/very_long_m2o.py the 
mappings succeed in compiling but many-to-one lazyloads on a long chain like 
that have never been tested.   Overall we don't have strong documentation / 
methodologies written down for "long chain" relationships like these since this 
is not really the primary use case of relationship.   

I'd advise not relying upon relationship() to join out that long for now.    In 
my own applications, I reserve all my "long chains of joins" as explicitly 
written in session.query() calls.  The relationships themselves are simple.

The issue here is one of those where I have to set aside 2 hours of time and 
focus on it so I'll try to get to it when I can.


-- 
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.

Reply via email to