Thanks Michael, Everything is OK now.
Sorry for the typo, I was renaming my classes. Regards, Laurent Le 04/09/2009 16:30, Michael Bayer a écrit : > asrenzo wrote: > >> Here is a primaryjoin, secondaryjoin I tried without success: >> >> neighbors = relation("Place", primaryjoin=("Place.id == >> neighbors_table.place_id"), secondaryjoin= >> ("neighbors_table.neighbor_id == Place.id"), >> secondary="neighbors_table") >> >> and the error is: >> >> sqlalchemy.exc.InvalidRequestError: When compiling mapper Mapper|Shop| >> shops, expression 'Shop.id == neighbours_table.shop_id' failed to >> locate a name ("name 'neighbours_table' is not defined"). If this is a >> class name, consider adding this relation() to the<class >> 'shoplocator.orm.shop.Shop'> class after both dependent classes have >> been defined. >> >> Which I can't understand because neighbors table is defined before the >> Place class definition. >> > the first strange thing is the message says "Shop.id" but the string you > are showing says "Place.id". Anyway, the Table object "neighbors_table" > is not part of the locals() when the string expressions are evaluated. > therefore just don't use string arguments for > primaryjoin/secondaryjoin/secondary, use the expression directly (i.e. > secondary=neighbors_table, primaryjoin=id==neighbors_table.c.neighbor_id). > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---