Hi,

I am trying to map a relation in class which allows it to access
objects from a couple of tables away ie.

class Zone(object):
    pass

class Sentence(object):
   pass

class RawTag(object):
    pass

class ProcessedTag(RawTag):
   pass

mapper(RawTag, tag_table)
mapper(Sentence, sentence_table, "ptags":relation(RawTag,
primaryjoin=and_(sentences_table.c.sentence_id==tag_table.c.sentence_id,
tag_table_table.c.deleted==0 ), secondary=processed_tag_table) )
mapper(ProcessedTag, processed_tag_table)
mapper(Zone, zone_table)

There is a 1:M relation between Document and Sentence and between
Sentence and RawTag. I want to be able to access all of the
ProcessedTags for a Zone from the Zone class, I can do this for the
Sentences table using the "tags" relation that I defined. But I am
having trouble in allowing the same behaviour for Zone.

So I have tried to use primaryjoin in order to to do this but I am not
having any luck.
Among the many exceptions I can generate:
 "ptags":relation(ProcessedTag,
primaryjoin=and_(and_(sentences_table.c.zone_id ==
zones_table.c.zone_id,
sentences_table.c.sentence_id==tags_table.c.sentence_id),
tags_table.c.deleted==0 ), secondary=processed_tag_table)

UnmappedColumnError: No column sentences.sentence_id is configured on
mapper Mapper|Zone|zones

Any pointers greatly appreciated!

Many thanks
Nathan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to