On Feb 3, 2012, at 1:04 PM, Mason wrote:

> Hi,
> 
> If i have a table named 'message' and it has the following columns:
> message_id, tar_del, src_del.  I pass in del_list which is a list of
> message to delete.  I tried the following
> 
> self.session.query(Message)\
>                 .filter(Message.message_id.in_(del_list))\
>                 .update({Message.tar_del: self._DELETE})
> 
> but kept getting this error
> 
>  File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py",
> line 2598, in update
>    "Could not evaluate current criteria in Python. "
> InvalidRequestError: Could not evaluate current criteria in Python.
> Specify 'fetch' or False for the synchronize_session parameter.

the error message refers to the "synchronize_session" parameter of the update 
method:

http://docs.sqlalchemy.org/en/latest/orm/query.html?highlight=query.update#sqlalchemy.orm.query.Query.update

pass "False" for this value instead of the default of "evaluate":

query.update({Message.tar_del:self._DELETE}, synchronize_session=False)


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.

Reply via email to