Thank you, Bobby and Michael. This seems to work now. I'm still waiting for your book, Michael. Hope it comes soon!
A. On Jun 12, 5:29 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: > the "foreign keys" argument as yet is not propagated to the backref (the > primaryjoin is), I should look into fixing that, but for now use > backref=backref('owner', primaryjoin=pj, foreign_keys=[the foreign keys]). > > > > Affect wrote: > > > Hello: > > > When I use the foreign_keys argument to the relation function in the > > mapper of SA, I get the following error: > > > ArgumentError: Could not determine relation direction for primaryjoin > > condition 'drm_owners.owner_id = drm_contract_royalties.contract_id', > > on relation Royalty.owner. Specify the 'foreign_keys' argument to > > indicate which columns on the relation are foreign. > > > This error only shows when the 'backref' argument is specified and not > > otherwise! Is this a bug in alchemy or am I missing something? > > > Here's the mapper conf: > > =================== > > mapper(Royalty, royalties_table) > > mapper(Owner, owners_table, > > properties = { > > 'works': relation(Work, backref='owner'), > > 'royalty': relation(Royalty, > > > primaryjoin=owners_table.c.owner_id==royalties_table.c.contract_id, > > foreign_keys=[royalties_table.c.contract_id], > > backref='owner') > > }) > > > So, if I remove the 'backref' argument from the call to 'relation', > > the relation works, but of course I lose the backref 'owner'. > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---