I have a (deep) tree structure
main
area
category
criteria
inputs
all tables with one_to_many relationships except criteria -> inputs
which is many_to_many.
I need to set up a relationship for `main` as list of all distinct
inputs of its sub-sub-sub-criteria as in this query:
select distinct inputs.*
from main, areas, categories, criteria, inputs, criterion_input
where main.id = areas.id_main
and areas.id = categories.id_area
and categories.id = criteria.id_cat
and criteria.id = criterion_input.id_crit
and inputs.id = criterion_input.id_input
but I can't even reach criteria... :(
In fact with:
orm.mapper(Main, main,
properties={
'criteria': orm.relationship(Criterion,
foreign_keys=[areas.c.id_main, categories.c.id_area,
criteria.c.id_cat],
primaryjoin=and_(main.c.id==areas.c.id_itaca,
areas.c.id==categories.c.id_area,
categories.c.id==criteria.c.id_cat),
viewonly=True)
})
I get this error:
ArgumentError: Local column 'areas.id' is not part of mapping Mapper|
Main|main. Specify remote_side argument to indicate which column lazy
join condition should compare against.
Thank you for your support
--
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.