[sqlalchemy] Re: Deleted rowcount x does not match number of objects deleted y [PART 2]

2008-10-25 Thread Michael Bayer
yup. specifically with the session.delete() thing, by you saying parent.collection.remove(obj), you're doing the collection management yourself. delete(x) doesn't work since SQLA does not attempt to locate all the collections which "x" is a part of.It's a very common issue but we don

[sqlalchemy] Re: Deleted rowcount x does not match number of objects deleted y [PART 2]

2008-10-25 Thread jack2318
Hi Mike, Thanks. I learning SQA and I am trying to get the general feeling. I guess the idea is to use Python directly and Session take care of the SQL in the background. mOutOrder = mapper(dbOutOrder, tbl_outHeader, properties={'lines': relation(dbOutLine, cascade="all, delete-orphan")}) mOutLin

[sqlalchemy] Re: Deleted rowcount x does not match number of objects deleted y [PART 2]

2008-10-24 Thread Michael Bayer
On Oct 24, 2008, at 9:08 PM, jack2318 wrote: > > 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)