rollback can be screwed up
Issue #1674
resolved
no test case for this yet. Its things being deleted, re-added, using natural primary keys. the rollback has to remove everything that was "new" first, not sure why that didnt happen here, perhaps cascade.
Traceback (most recent call last):
File "scripts/update_rss.py", line 16, in <module>
install_rss()
File "/Users/classic/dev/path.com/path/path/installer/rss.py", line 163, in install_rss
Session.flush()
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/scoping.py", line 127, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 1324, in flush
self._flush(objects)
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 1408, in _flush
transaction.rollback()
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 394, in rollback
transaction._rollback_impl()
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 408, in _rollback_impl
self._restore_snapshot()
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 284, in _restore_snapshot
self.session._update_impl(s)
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 1227, in _update_impl
self._attach(state)
File "/Users/classic/dev/path.com/lib/python2.6/site-packages/SQLAlchemy-0.6beta1dev_r6720-py2.6.egg/sqlalchemy/orm/session.py", line 1254, in _attach
(mapperutil.state_str(state), state.key)
sqlalchemy.exc.InvalidRequestError: Can't attach instance <MyClass at 0x74b9fb0>; another instance with key (<class 'path.model.stats.MyClass'>, (UUID('251969db-93f4-57df-afb7-b257ee93db27'),)) is already present in this session.
Comments (3)
-
reporter -
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.6.0 (automated comment)
- Log in to comment
at the very least, we shoudl figure out some way to get the original stack trace to come from the flush even if rollback fails.