On Sep 1, 2006, at 10:21 AM, dmiller wrote:
> Ahh, it looks like the same thing is happening in your test program,
> so that's not causing my problem (and I guess it's not a bug either).
> Why does that happen though? Here's another example:
>
> For reference, here's a snippet of the output of your test program:
>
> Blog.posts 6092976
> Post.blog 6071408
> ...
> Blog: {('hasparent', 6071408): True, 'modified': True}
> Post {('hasparent', 6206960): True, ('hasparent', 6092976): True,
> 'modified': True}
>
> Why does b._state have a 'hasparent' record for p1.blog? That would
> imply that "p1.blog" is the parent of "b", which doesn't seem logical
> to me. This is exactly what was happening in my program (and I
> thought it was a bug).
well the attribute package doesnt actually know who is a "parent" of
whom. because we put a "trackparent=True" flag on all the attributes
in both directions, its going to keep records in both directions. so
maybe the term "parent" is not really the right term. maybe the term
"reference" would be better...its really just a "does this object
have someone pointing to it as part of that someone's XYZ property".
the orphan check is the part thats done in only one direction,
however, so we only use one of those "hasparent" records to figure
that out.
With a bi-directional relationship such as this, b has a 6071408/
Post.blog entry to indicate that its referenced by a Post's "blog"
relation. p1 has a "parent" record for the "Blog.posts" and the
"Comment.post" property, since it is referenced by both a Blog and a
Comment using those relations.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users