you might want to try having "display_keywords" not implemented as a relation, since you are pushing the envelope by sticking an association table into the primary join condition..the eager loading doesnt know how to handle that. its also pretty inefficient to outer join on the same set of tables twice. youre really looking to have an association object pattern here.
On Oct 23, 2006, at 8:09 AM, Steve Zatz wrote: > > Briefly, I have a situation in which a mapper works fine unless I > change loading to lazy=False on one of the relationships. > > The mapper is: > > mapper(Item, item_table, properties = dict(keywords = relation > (Keyword, > secondary=itemkeyword_table, lazy=False, backref='items'), > display_keywords = relation(Keyword, > primaryjoin=and_ > (keyword_table.c.uuid==itemkeyword_table.c.keyword_uuid, > item_table.c.uuid==itemkeyword_table.c.item_uuid, > itemkeyword_table.c.display==True), > viewonly=True, foreignkey=keyword_table.c.uuid, lazy=False),)) > > It is the display_keywords relationship that is the problem, without > lazy=False, it works fine and with it I get the following exception: > > sqlalchemy.exceptions.SQLError: (OperationalError) no such column: > item_keyword.display 'SELECT item.note AS item_note, item.uuid AS > item_uuid, item.deleted AS item_deleted, item.section_id AS > item_section_id, item.createdate AS item_createdate, keyword_6166.uuid > AS keyword_6166_uuid, keyword_6166.deleted AS keyword_6166_deleted, > keyword_6166.timestamp AS keyword_6166_timestamp, keyword_6166.name AS > keyword_6166_name, item.duedate AS item_duedate, item.priority AS > item_priority, item.finisheddate AS item_finisheddate, item.timestamp > AS item_timestamp, keyword_2ff3.uuid AS keyword_2ff3_uuid, > keyword_2ff3.deleted AS keyword_2ff3_deleted, > keyword_2ff3.timestamp AS > keyword_2ff3_timestamp, keyword_2ff3.name AS keyword_2ff3_name, > item.id > AS item_id, item.name AS item_name \nFROM item LEFT OUTER JOIN keyword > AS keyword_6166 ON keyword_6166.uuid = item_keyword.keyword_uuid AND > item.uuid = item_keyword.ite > m_uuid AND item_keyword.display = ? LEFT OUTER JOIN item_keyword AS > item_keyword_2d36 ON item.uuid = item_keyword_2d36.item_uuid LEFT > OUTER > JOIN keyword AS keyword_2ff3 ON keyword_2f > f3.uuid = item_keyword_2d36.keyword_uuid ORDER BY item.oid, > keyword_6166.oid, item_keyword_2d36.oid' [1] > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
