I’m not familiar with “synchronize_session()” as a method call on Query, “synchronize_session” is a keyword argument passed to update(), and in this case you’d do either “fetch” or False.
On Nov 18, 2013, at 11:28 AM, Adam Tauno Williams <awill...@whitemice.org> wrote: > On Mon, 2013-11-18 at 10:23 -0500, Michael Bayer wrote: >> we support this though I’m not finding a doc so easily, > > Yep. > >> I believe you’d just index the key: update({User.prefs[‘transitAvaiable’]: >> True}) > > That fails; with the same message, regardless of if I specify > synchronize_session('fetch') or not. > > session.query(User).\ > filter(User.prefs.has_key('inboundBusStop')).\ > update({User.prefs['transitAvaiable']: True, }).\ > synchronize_session('fetch') > > Traceback (most recent call last): > File "use-hstore.py", line 47, in <module> > update({User.prefs['otherkey']: 'fred', }).\ > File > "/home/awilliam/projects/whitemice/lib/python2.7/site-packages/sqlalchemy/orm/query.py", > line 2690, in update > update_op.exec_() > File > "/home/awilliam/projects/whitemice/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", > line 815, in exec_ > self._do_pre_synchronize() > File > "/home/awilliam/projects/whitemice/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", > line 866, in _do_pre_synchronize > "Could not evaluate current criteria in Python. " > sqlalchemy.exc.InvalidRequestError: Could not evaluate current criteria > in Python. Specify 'fetch' or False for the synchronize_session > parameter. > > > -- > Adam Tauno Williams <mailto:awill...@whitemice.org> GPG D95ED383 > Systems Administrator, Python Developer, LPI / NCLA
signature.asc
Description: Message signed with OpenPGP using GPGMail