On Feb 23, 2006, at 9:10 AM, dmiller wrote:


What I'm saying is, since you're using the backref to automatically add an item to a collection can you use the backref to automatically remove the item when it's deleted?


thats not a straight line of comparison.... the backref works in both ways, in that one way it automatically adds an item to a colleciton when the collection's parent is set as an attribute on the item, the other way it automatically deletes from the collection when the collection's parent is removed as an attribute on the item. the corresponding "delete" operation, at that level (i.e. attribute stuff happens with no knowledge of SQL or ORMs at all), would be that the object is dereferenced and collected by the python garbage collector. which only happens if you explicitly remove it from the list. so within the "attrtibute management" field of things, its "complete". i think thats another thing that makes me uncomfortable here, the delete() operation is currently a unit-of-work operation, its not really a "python in-memory object manipulation" operation...we are conflating two separate things.

what we might be looking for here, is a regular "del object" type of thing, at which point the attribute system would do what it can to remove that object from the graph totally, including locating all its lists, etc. which I suppose I should look into seeing how involved that is (i think probably not too much) and how much operational/ memory overhead it adds (a little concerned about that) before I keep raising that as an issue. then the ORM places a hook onto that operation and adds its own "objectstore.delete()" operation to that one.

Hibernate has a bunch of cascade types that control the exact behavior of relationships between entities. In general I find their approach to be very flexible and very confusing (at least at first)...


well I actually havent looked at their patterns very much (even though I have just taken on a job that uses hibernate), in the interests of just doing things pythonically and not getting bogged down with issues that may not exist at all outside of more rigid languages like java. so far we havent had too many issues like this, the backref thing was the big major enhancement (and hibernate doesnt even do that). am hoping we can start with our simple "core" and build onto it as needed (with maybe this new thing), ultimately having something simpler and quite different from hibernate's.






-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to