[sqlalchemy] InvalidRequestError

2011-03-12 Thread AJAY PATTNI
We use sqlalchemy 0.4.6 with Elixir 0.5.2 and zope.sqlalchemy Every once a while we get this error(see below): In a previous thread somebody said, just 'rollback your session when the exception is raised'? We use a global session as follows: __session__ =

Re: [sqlalchemy] Commit many queries at once

2011-03-12 Thread Michael Bayer
On Mar 11, 2011, at 6:41 PM, eddy wrote: Like in session we commit all changes in one commit is there any way we can execute different queries at one. for eg q1 = some.table update.query1 q2 = some.table.update.query2 instead of updating table one at a time like running q1.execute()

Re: [sqlalchemy] InvalidRequestError

2011-03-12 Thread Michael Bayer
On Mar 11, 2011, at 7:51 PM, AJAY PATTNI wrote: We use sqlalchemy 0.4.6 with Elixir 0.5.2 and zope.sqlalchemy Every once a while we get this error(see below): In a previous thread somebody said, just 'rollback your session when the exception is raised'? We use a global session as

[sqlalchemy] Is there a way to generate this UPDATE statement?

2011-03-12 Thread Darren Yin
The MySQL documentation has the followinghttp://dev.mysql.com/doc/refman/5.1/en/update.htmlexample syntax for multi-table UPDATES: UPDATE items, month SET items.price=month.price WHERE items.id=month.id; Is there a way to generate that via SQLAlchemy? The closest thing to it I could find in the

Re: [sqlalchemy] Is there a way to generate this UPDATE statement?

2011-03-12 Thread Michael Bayer
On Mar 12, 2011, at 11:41 PM, Darren Yin wrote: The MySQL documentation has the following example syntax for multi-table UPDATES: UPDATE items, month SET items.price=month.price WHERE items.id=month.id; Is there a way to generate that via SQLAlchemy? The closest thing to it I could

Re: [sqlalchemy] Re: Has anyone already got a collection_class mod that uses defaultdict?

2011-03-12 Thread Michael Bayer
On Mar 10, 2011, at 6:20 PM, Eric Ongerth wrote: So, jek, if you're listening, or anyone else -- is there an already existing, working implementation of a Dict of Lists or Dict of Sets collection class? the association_proxy is always there to flatten the object in the middle of two

Re: [sqlalchemy] Is there a way to generate this UPDATE statement?

2011-03-12 Thread Michael Bayer
On Mar 13, 2011, at 1:23 AM, Michael Bayer wrote: ORM: sess.query(Item).update(price=sess.query(Month.price).filter(Item.id==Month.id).as_scalar(), False) try again: sess.query(Item).update({'price':sess.query(Month.price).filter(Item.id==Month.id).as_scalar()}, False) --