[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)

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

2008-10-24 Thread jack2318
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):

[sqlalchemy] Deleted rowcount x does not match number of objects deleted y

2008-10-24 Thread jack2318
Hi, I guess I am doing something wrong but looking on 'raw' SQL it looks fine. My code: session = Session() order = session.query(dbOutOrder).get(2) for line in order.lines: session.delete(line) session.flush() #session.commit() for i in range(1,

[sqlalchemy] Re: sql views - how?

2008-10-24 Thread Kyle Schaffrick
On Thu, 23 Oct 2008 16:16:50 -0400 Michael Bayer <[EMAIL PROTECTED]> wrote: > > On Oct 23, 2008, at 3:40 PM, [EMAIL PROTECTED] wrote: > > > > > hi > > i've no much idea about sql views, so i want to ask something. > > As i understand, views are sort-of virtual tables consisting of > > whatever

[sqlalchemy] Re: Mapping to views

2008-10-24 Thread Michael Bayer
On Oct 24, 2008, at 3:28 PM, john.goodleaf wrote: > > It looks like it might be easier to define a Table object using the > view, specifying a PrimaryKeyConstraint and then using the mapper > function to tie it to a class. Do you think this would work? that's exactly how it would work, you jus

[sqlalchemy] Re: Mapping to views

2008-10-24 Thread john.goodleaf
It looks like it might be easier to define a Table object using the view, specifying a PrimaryKeyConstraint and then using the mapper function to tie it to a class. Do you think this would work? Would I need to write a properties argument to the mapper? Apologies if these are stupid questions. I

[sqlalchemy] Re: Mapping to views

2008-10-24 Thread Michael Bayer
On Oct 24, 2008, at 11:41 AM, john.goodleaf wrote: > > So here's the problem. I am faced with two legacy systems outside my > control. One is SQL Server and the other is Oracle. In both only views > are exposed to me and I don't anticipate that changing. > > I'd like to map these views to object

[sqlalchemy] Mapping to views

2008-10-24 Thread john.goodleaf
So here's the problem. I am faced with two legacy systems outside my control. One is SQL Server and the other is Oracle. In both only views are exposed to me and I don't anticipate that changing. I'd like to map these views to objects. Of course, it's read-only so I'm not concerned with the other