mark at microenh.com
Mon Aug 23 13:29:11 CEST 2010
On Aug 22, 2010, at 11:12 AM, m g wrote:
>> If I use a set as the container for the child objects and add a new child object and commit the session, the data is updated to the database correctly. If I delete a child object, the corresponding record in the database isn't getting deleted.
> del child_object
> session.delete(child_object) ?
Thanks. I think that was indirectly part of the problem. The problem appears to be either with my understanding of sets or the instrumentation that SQLAlchemy adds.
I've got something that works (it passed my unittests), but it's not as elegant as I would like.
In short, while I was able to create an object that could be added and removed from a SA InstrumentedSet, it looks like the instrumentation that SA adds wasn't correctly detecting removal of objects. I had to remove the object by brute force (iterate through the set to find the exact object to remove and remove that object) to get SA to recognize it.
More information about the CentralOH