[Sqlalchemy-tickets] Issue #4073: regression in bulk update, evaluator disallows literal_column (zz
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2017-09-10 03:32:16
|
New issue 4073: regression in bulk update, evaluator disallows literal_column https://bitbucket.org/zzzeek/sqlalchemy/issues/4073/regression-in-bulk-update-evaluator Michael Bayer: ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) x = Column(Integer) y = Column(Integer) e = create_engine("sqlite://", echo=True) Base.metadata.create_all(e) s = Session(e) s.add(A(x=1, y=2)) s.commit() s.query(A).update({A.x: literal_column('y')}) ``` result: ``` #! Traceback (most recent call last): File "test.py", line 22, in <module> s.query(A).update({A.x: literal_column('y')}) File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/query.py", line 3366, in update update_op.exec_() File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1324, in exec_ self._do_pre_synchronize() File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1399, 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. ``` this affects openstack nova and the soft_delete() method in oslo.db which uses this. |