[sqlalchemy] Re: Table updates using data mapping

2007-06-27 Thread voltron
Thanks Mike, that clears up a few things On Jun 27, 2:08 am, Mike Orr [EMAIL PROTECTED] wrote: On 6/26/07, voltron [EMAIL PROTECTED] wrote: sess = create_session() allusers = sess.query(User).select() for user in allusers: user.group = contractor print x.name This adds the

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Rick Morrison
Updates and inserts on the ORM side of the street are single-object kinds of things. The pattern is to load a list of objects, make the appropriate modifications to the those in-memory objects, and then issue a session flush(). This type of bulk operation is best done with the SQL generation

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread voltron
would I have to do something like this? sess = create_session() allusers = sess.query(User).select() for user in allusers: user.group = contractor print x.name On Jun 26, 10:40 pm, voltron [EMAIL PROTECTED] wrote: Could someone tell me how I would execute this SQL using data

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Michael Bayer
On Jun 26, 2007, at 4:51 PM, Rick Morrison wrote: Updates and inserts on the ORM side of the street are single-object kinds of things. The pattern is to load a list of objects, make the appropriate modifications to the those in-memory objects, and then issue a session flush(). This

[sqlalchemy] Re: Table updates using data mapping

2007-06-26 Thread Mike Orr
On 6/26/07, voltron [EMAIL PROTECTED] wrote: sess = create_session() allusers = sess.query(User).select() for user in allusers: user.group = contractor print x.name This adds the overhead of creating a Python object for every row. If you already have many of the objects in memory