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.
What does the error mean? What I ended up doing is
rows = self.session.query(Message)\
.filter(Message.message_id.in_(del_list))\
.all()
for r in rows:
if key == 'src_del'
r.src_del = self._DELETE
elif key == 'tar_del'
r.tar_del = self._DELETE
and just loop through the rows return, but I think this is not very
efficient.
Also, to reference a table column, I do r.src_del and r.tar_del, is it
possible to make it a variable, so I can do something like r[key] =
self._DELETE?
Thanks,
Mason
--
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.