On Jun 27, 10:54 am, remi jolin <[EMAIL PROTECTED]> wrote:

> I first tried to add the backref on only one side but the relationship
> was not bi-directional ; user.addresses.append(a) updated address.user
> but not the other way, that's why I added it both sides.

try not to use add_property() for this reason; if mappers have already
been compiled, add_property() is going to be less reliable.  the
regular backref will create fully bi-directional behavior at the
attribute level.  i think i might want add_property() to even raise an
exception if used after mappers are compiled.


>
> Then, with backrefs defined on both "add_property", I had a look at the
> structures created at the mapper level (properties, reverse_property,
> ...) and they seemed coherent but I was not sure it was enough.

> OK, I'll do it that way if it is the supported way. Thanks for the hint.
> Does the "is_backref" needs to be on a specific side of the relation ??

yes i completely forgot about "reverse_property".  the fact is, you
have to use the "backref" flag to get a fully working bi-directional
relationship.  trying to manually craft one, even if you get it
working, is not going to be forwards compatible since flags like
"is_backref" and "reverse_property" are not public (and should
probably be underscored).  so no, i cant say that using "is_backref"
explicitly is supported right now since it bypasses the usage of the
backref() construct.  im going to see if i can underscore this in 0.4.




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