On Thursday 26 June 2008 17:34:00 Michael Bayer wrote:
> On Jun 26, 2008, at 7:22 AM, [EMAIL PROTECTED] wrote:
> > hi
> > just an idea: is it possible to have half-baked
> > backref-declarations?
> >
> > i want to use the SA's way of inventing backrefs from a name, and
> > just provide some extra arguments to that invention.
> >
> > instead now i have a full backref(...) having more or less all of
> > the relation(...) arguments, but with additional logic on
> > picking/swapping of primaryjoin/secondaryjoin - something that SA
> > does internaly in the PropertyLoader constructor.
>
> this sounds like you mean:
>
>
> x: relation(Foo, backref="somebackref", backref_primaryjoin=xxxxxx,
> backref_remote_site=xxxxx)
>
> ?
sort of, 
x: relation( Foo, primaryjoin=, secondaryjoin=,remote_side=,whatever,
       backref= halfbackref(name=abc,post_update=True))
and let it construct the backref from relation.primary/secondaryjoin 
etc, putting name and whatever extra args are there.
so arguments of halfbackref are considered "extra" to those implied 
from the relation itself.


> > btw remote_side is not propagated by PropertyLoader constructor -
> > but IMO is needed.
>
> remote_side by definition cannot be the same on both sides of a
> relation.  do you mean the backref should "figure it out" based on
> the forwards-facing explicit remote_side ?   
yes, if there is explicit forward remote_side, the backward should be 
guessable. if that needs extra info like pjoins etc, so be it.
heh, by definition... right now i'm giving same thing to both sides 
and it seems to work. but not really sure, i havent tested heavily 
the backref-using stuff. 

> Actually I can't see 
> how that would work, if SA can't figure out the forwards facing one
> I don't think it would be that great for it to try guessing the
> backwards facing one.

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

Reply via email to