I have a MySQL table structure in which an apple relates to many
oranges, which relate to many bananas.  DELETE an apple, and oranges
and bananas are DELETED via cascade.

I'm seeing a successful DELETE of a single orange followed by a SELECT
of the orange's related bananas and then a second attempt to delete
the orange.  This results in a "ConcurrentModificationError: Deleted
rowcount 0 does not match number of objects deleted 1" because the
orange has already been deleted.

Since I haven't tracked trunk for awhile, this too could be the result
of my own ignorance.  The following code works in 5057 and fails in
5058.  Any hints are much appreciated!


while apple.orangesrelation:
        session.delete(apple.orangesrelation.pop())


Revision log for 5058 follows SQL log below:


DELETE FROM orange WHERE orange.orange_id = %s
[1482049L]
SELECT ... FROM banana  WHERE %s = banana.orange_id
[1482049L]
DELETE FROM orange WHERE orange.orange_id = %s
[1482049L]
ROLLBACK


r5058 | zzzeek | 2008-08-24 17:31:00 -0400 (Sun, 24 Aug 2008) | 5
lines

- Session.delete() adds the given object to the session if
not already present.  This was a regression bug from 0.4
[ticket:1150]

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