> you can set up a relation() that has a "primaryjoin" expressing the
> whole thing, and use a flag that is currently only in the trunk
> called "viewonly=True" on the relation so its not used in flushes.

This would be very cool.  I think I am close but not quite there.
Here is the mapper:

mapper(Section, section_table, properties = {'items': relation(Item,
backref='section'), 'keywords': relation(Keyword,
primaryjoin=and_(and_(keyword_table.c.uuid==itemkeyword_table.c.keyword_uuid,
item_table.c.uuid==itemkeyword_table.c.item_uuid),
section_table.c.id==item_table.c.section_id),
viewonly=True)})

When I try to use the mapper, I get the following error:

sqlalchemy.exceptions.ArgumentError: Cant determine relation direction
for 'keywords' in mapper 'Mapper|Keyword|keyword' with primary join
 '(keyword.uuid = item_keyword.keyword_uuid AND item.uuid =
item_keyword.item_uuid) AND section.id = item.section_id'

Not sure if I need the nested and_s, but with or without them, I get
this error.  It's probably obvious but I am not sure what the issue
is.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to