Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-24 Thread Michael Bayer
On Feb 23, 2006, at 12:21 AM, Kapil Thangavelu wrote: not sure if its related but i've looking for on delete and on update actions functionality, ie. on delete cascade. i've been using a foreign key subclass below and some db specific engine changes (attached) in get_col_spec method (thoug

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-23 Thread Michael Bayer
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 bo

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-23 Thread dmiller
On Feb 23, 2006, at 12:06 AM, Michael Bayer wrote: On Feb 22, 2006, at 11:47 PM, Daniel Miller wrote: The more I think about it the more I lean toward having it removed from the parent collection after the child is deleted (when the session is committed, not before). yah its just a prett

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-22 Thread Kapil Thangavelu
Michael Bayer wrote: On Feb 22, 2006, at 11:47 PM, Daniel Miller wrote: The more I think about it the more I lean toward having it removed from the parent collection after the child is deleted (when the session is committed, not before). yah its just a pretty big monkeywrench to throw in..

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-22 Thread Michael Bayer
On Feb 22, 2006, at 11:47 PM, Daniel Miller wrote: The more I think about it the more I lean toward having it removed from the parent collection after the child is deleted (when the session is committed, not before). yah its just a pretty big monkeywrench to throw in...a commit() operat

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-22 Thread Daniel Miller
Michael Bayer wrote: is the exception thrown upon deleting the object, or upon saving a list that contains a deleted object? I can add an exception for the latter pretty easily (probably should). It happens on session.flush() in Hibernate, which is session.commit() in SQLAlchemy. The collect

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-22 Thread Michael Bayer
is the exception thrown upon deleting the object, or upon saving a list that contains a deleted object? I can add an exception for the latter pretty easily (probably should). The former requires that I track all the lists every object belongs to. what is the reason hibernate doesnt remo

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-22 Thread dmiller
After a bit of research, I found out that Hibernate does not do this automatically either. However, an exception is thrown if a child object is deleted and that object is in a list: ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)

Re: [Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-21 Thread Michael Bayer
currently its not removing deleted items from lists. if you had an object "A" that was installed within the lists of 20 other objects, would I maintain a backwards lookup table of all the lists that object is present in to find them when its marked as deleted ? i fear that may an excessiv

[Sqlalchemy-users] One-to-Many doesn't remove deleted items from list on delete

2006-02-21 Thread dmiller
Example: >>> en = Entity(...) # SQLAlchemy entity class >>> len(en.attrs) 2 >>> a = en.attrs[0] >>> objectstore.delete(a) >>> len(en.attrs) # should this return 1? 2 >>> objectstore.commit() >>> len(en.attrs) # this should definitely return 1 2 It appears that AttributeManager is not removing de