Dear all,
I make a query to find the highest version of a document and then I
want to set a flag to column "actual" to 1 (TRUE) to all entries
satisfying the query. I dont want to loop through hits but to set this
flag "in a one stroke" with update. However I get this error:
sqlalchemy.exc.InvalidRequestError: Could not evaluate current
criteria in Python. Specify 'fetch' or False for the
synchronize_session parameter. (Related to the line with update
function!!). What is the problem or is there any alternative?
Thanks

metadata,session,engine=myf(confile)
mytab = Table(dbname, metadata, autoload=True)
class SomeTable(object):
        pass
mapper(SomeTable,mytab).compile()
vquery=session.query(func.max(mytab.columns['version']),mytab.columns['id']).group_by(mytab.columns['id'])
endquery=session.query(mytab).filter(tuple_(mytab.columns['version'],mytab.columns['id']
 ).in_(vquery))
endquery.update({mytab.columns["actual"]:"1"})
ses.commit()

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to