[sqlalchemy] Re: Mapper issue with r4485
On Apr 10, 2008, at 8:46 PM, Steve Zatz wrote: I am not sure when the change was introduced but the following mapper, which previously worked: mapper(Section, section_table, properties = {'items': relation(Item, backref='section'), 'keywords':relation(Keyword, primaryjoin =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, foreign_keys=[keyword_table.c.uuid], remote_side=[item_table.c.section_id])}) now produces the following error: sqlalchemy.exceptions.ArgumentError: Could not determine relation direction for primaryjoin condition 'keyword.uuid = item_keyword.keyword_uuid AND item.uuid = item_keyword.item_uuid AND section.id = item.section_id', on relation Section.keywords (Keyword). Specify the foreign_keys argument to indicate which columns on the relation are foreign. I am not sure what needs modification in the mapper to be compatible with the current trunk. I've added this example as a unit test and will have to relax the viewonly rules a bit more to handle this - the primaryjoin along many tables use case which is not that unusual. I'll get back to you shortly. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Mapper issue with r4485
On Apr 10, 2008, at 8:46 PM, Steve Zatz wrote: I am not sure when the change was introduced but the following mapper, which previously worked: mapper(Section, section_table, properties = {'items': relation(Item, backref='section'), 'keywords':relation(Keyword, primaryjoin =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, foreign_keys=[keyword_table.c.uuid], remote_side=[item_table.c.section_id])}) now produces the following error: sqlalchemy.exceptions.ArgumentError: Could not determine relation direction for primaryjoin condition 'keyword.uuid = item_keyword.keyword_uuid AND item.uuid = item_keyword.item_uuid AND section.id = item.section_id', on relation Section.keywords (Keyword). Specify the foreign_keys argument to indicate which columns on the relation are foreign. I am not sure what needs modification in the mapper to be compatible with the current trunk. my hat's off to you for coming up with that relation(), it works again in rev 4486. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Mapper issue with r4485
my hat's off to you for coming up with that relation(), it works again in rev 4486. Ah the irony ... check out http://tinyurl.com/6kqv94 And thanks as always for your remarkable responsiveness and for sqlalchemy. It is indispensible. Steve --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---