Michael,

Thanks for the quick reply.


> this might be useful.  but it only helps in a very narrow set of 
> cases.....primaryjoin is not usually needed when theres a non-ambiguous 
> foreign key relationship, and when primaryjoin is needed, many of those 
> cases require joins that are more complex than just one column.  the 
> parameter should at least somehow be agnostic of single/composite 
> primary keys.   im also not thrilled about adding more arguments that 
> are essentially modified versions of a more generic argument that 
> already exists, but i see your point about the table def driving the 
> relationship.

I can certainly appreciate your hesitancy to add additional arguments 
especially those with potentially limited usage.  It has however come up 
several times in my projects where I am linking nodes to each other. 
There does seem there is a bit of inherent ambiguity the way relations 
are defined by referencing the destination class.  Would it be possible 
to specify the table columns instead of the destination class in the 
relation?  ie:

mapper(Association, association_table, properties={
     'source':relation(association_table.c.source_id, 
backref=backref("options")),
     'object':relation(association_table.c.object_id, 
backref=backref("optioned"))
})

It isn't as clean (we have to go look in our table definition to see to 
what class we are joining) but at least avoids having to try to infer 
which column we are talking about from the destination class.  Otherwise 
  an 'oncolumn=' hint would make sense in my trivial case (not sure 
about more complex cases, a list perhaps?)

> 
> what happens if you just make a regular "backref" without putting 
> explicit join conditions in ?  recent releases should be able to derive 
> it from the primaryjoin/secondaryjoin arguments in the parent relation 
> without needing it re-specified.
> 
I am using version 0.2.7 and it seems to require the primaryjoin.  Glad 
to hear this has been resolved.

Thanks again for all your efforts.

-brian

-------------------------------------------------------------------------
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