[Sqlalchemy-tickets] Issue #3476: StaleDataError in sqlalchemy 1.0.6 (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
|
From: Patrick H. <iss...@bi...> - 2015-07-07 23:13:24
|
New issue 3476: StaleDataError in sqlalchemy 1.0.6 https://bitbucket.org/zzzeek/sqlalchemy/issues/3476/staledataerror-in-sqlalchemy-106 Patrick Hayes: When calling `bulk_update_mappings` in version 1.0.6, occasionally StaleDataErrors emerge. Previously I was using the fork at https://github.com/pfhayes/sqlalchemy (from this GitHub PR: https://github.com/zzzeek/sqlalchemy/pull/181) and no StaleDataErrors were ever observed. I tried updating to 1.0.6 and StaleDataErrors started to occur frequently. They happen intermittently when calling code like this: ```python Base = declarative_base() class User(Base): id = Column(BigInteger, primary_key=True) score = Column(DOUBLE_PRECISION) session.bulk_update_mappings(User, { 'id': X, 'score': Y, ... }) ``` The StaleDataError typically looks like ``` StaleDataError: UPDATE statement on table 'users' expected to update 18 row(s); 17 were matched. ``` It seems to always expect n+1 when n are matched. I haven't been able to get a consistent repro. Any suggestions on this? Responsible: zzzeek |