I am really sorry but I pressed POST before I was ready. So again the code (without comments)
session = Session() order = session.query(dbOutOrder).get(2) for line in order.lines: session.delete(line) session.flush() for i in range(1,10): line = dbOutLine() line.HEADER_id = order.id line.ITEM_SKU_id = 1 line.QTY = 1 order.lines.append(line) session.add(order) session.flush() i = 0 for line in order.lines: if i % 2 == 0: print "DELETE" session.delete(line) i += 1 session.commit() and the mappers: mOutOrder = mapper(dbOutOrder, tbl_outHeader, properties={'lines': relation(dbOutLine)}) mOutLine = mapper(dbOutLine, tbl_outLine) as soon as I get to commit I get error: Unexpected error: <class 'sqlalchemy.orm.exc.ConcurrentModificationError'> Deleted rowcount 5 does not match number of objects deleted 7 What I am doing wrong? Of course if I issue commit after first delete everything is fine. Any hints? -- jacek PS: Sorry again for the previous POST. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---