- changed milestone to 0.9.10
- edited description
query.update check, warning in 0.9 execption in 1.0, incorrect for pypy
Issue #3405
resolved
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)
data = Column(String)
e = create_engine("sqlite://", echo=True)
Base.metadata.create_all(e)
s = Session(e)
s.query(A).update({"data": "foo"})
run w/ pypy:
#!
Traceback (most recent call last):
File "app_main.py", line 75, in run_toplevel
File "test.py", line 19, in <module>
s.query(A).update({"data": "foo"})
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/query.py", line 2939, in update
self, synchronize_session, values, update_args)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1183, in factory
}, synchronize_session, query, values, update_kwargs)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1069, in _factory
return klass(*arg)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1173, in __init__
super(BulkUpdate, self).__init__(query)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1034, in __init__
self._validate_query_state()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/persistence.py", line 1052, in _validate_query_state
(methname, )
InvalidRequestError: Can't call Query.update() or Query.delete() when join(), outerjoin(), select_from(), or from_self() has been called
because we are testing () is ()
, bzzt
Comments (3)
-
reporter -
reporter - changed status to resolved
- Fixed regression from 0.9.10 prior to release due to
3349
where the check for query state on :meth:.Query.update
or :meth:.Query.delete
compared the empty tuple to itself usingis
, which fails on Pypy to produceTrue
in this case; this would erronously emit a warning in 0.9 and raise an exception in 1.0. fixes#3405
→ <<cset 681276b5b4ae>>
-
reporter - Fixed regression from 0.9.10 prior to release due to
3349
where the check for query state on :meth:.Query.update
or :meth:.Query.delete
compared the empty tuple to itself usingis
, which fails on Pypy to produceTrue
in this case; this would erronously emit a warning in 0.9 and raise an exception in 1.0. fixes#3405
(cherry picked from commit 681276b5b4ae48924c85a1c26af3f9bde3d77b5f)
→ <<cset 7f658511954d>>
- Fixed regression from 0.9.10 prior to release due to
- Log in to comment