did you try active_history? it tends to be critical in these kinds of > things. otherwise I will find time to look more closely. > sorry, I should have mentioned that: yes, I did, but I just realized I only tried it on the ‘many’ side (the backref)…
class Chapter(Base): __tablename__ = 'chapter' id = Column(Integer, primary_key=True) book_id = Column(Integer, ForeignKey('book.id')) book = relationship(Book, backref=backref('chapters', active_history=True, order_by=id)) … which had no effect on the results returned by load_history. Adding it to the ‘one’ side… class Chapter(Base): __tablename__ = 'chapter' id = Column(Integer, primary_key=True) book_id = Column(Integer, ForeignKey('book.id')) book = relationship(Book, active_history=True, backref=backref('chapters', order_by=id)) … causes a traceback: Book(1) no relationships updated Book(2) Traceback (most recent call last): File "~/python/sqlbooks.py", line 134, in <module> test() File "~/python/sqlbooks.py", line 131, in test session.commit() File "/dev/python/lib/sqlalchemy/orm/session.py", line 768, in commit self.transaction.commit() File "/dev/python/lib/sqlalchemy/orm/session.py", line 370, in commit self._prepare_impl() File "/dev/python/lib/sqlalchemy/orm/session.py", line 350, in _prepare_impl self.session.flush() File "/dev/python/lib/sqlalchemy/orm/session.py", line 1907, in flush self._flush(objects) File "/dev/python/lib/sqlalchemy/orm/session.py", line 2025, in _flush transaction.rollback(_capture_exception=True) File "/dev/python/lib/sqlalchemy/util/langhelpers.py", line 57, in __exit__ compat.reraise(exc_type, exc_value, exc_tb) File "/dev/python/lib/sqlalchemy/orm/session.py", line 1993, in _flush self.dispatch.after_flush(self, flush_context) File "/dev/python/lib/sqlalchemy/event/attr.py", line 218, in __call__ fn(*args, **kw) File "~/python/sqlbooks.py", line 86, in after_flush history = state.attrs[prop.key].load_history() File "/dev/python/lib/sqlalchemy/orm/state.py", line 653, in load_history PASSIVE_OFF ^ INIT_OK) File "/dev/python/lib/sqlalchemy/orm/state.py", line 264, in get_history return self.manager[key].impl.get_history(self, self.dict, passive) File "/dev/python/lib/sqlalchemy/orm/attributes.py", line 864, in get_history current = self.get(state, dict_, passive=passive) File "/dev/python/lib/sqlalchemy/orm/attributes.py", line 595, in get return self.set_committed_value(state, dict_, value) File "/dev/python/lib/sqlalchemy/orm/attributes.py", line 1057, in set_committed_value collection.remove_without_event(item) File "/dev/python/lib/sqlalchemy/orm/collections.py", line 669, in remove_without_event self._data()._sa_remover(item, _sa_initiator=False) File "/dev/python/lib/sqlalchemy/orm/collections.py", line 1052, in remove fn(self, value) ValueError: list.remove(x): x not in list as does adding it to both sides. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.