We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A simple script to reproduce
import transaction from sqlalchemy import create_engine from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy.orm import scoped_session from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from zope.sqlalchemy import ZopeTransactionExtension engine = create_engine('sqlite:///') session = scoped_session(sessionmaker( autocommit=False, autoflush=False, bind=engine, extension=ZopeTransactionExtension(keep_session=True) )) Base = declarative_base() class Foobar(Base): __tablename__ = 'foobar' id = Column(Integer, primary_key=True) name = Column(String) Base.metadata.bind = engine Base.metadata.create_all() with transaction.manager: foobar = Foobar(id=1, name='john') session.add(foobar) foobar = session.query(Foobar).get(1) with transaction.manager: foobar.name = 'jackson' session.flush() # boom! sqlalchemy.orm.exc.DetachedInstanceError will be raised print foobar.name
After looking into the code, this is caused by join_transaction in mark_changed method doesn't take keep_session and pass along properly.
join_transaction
mark_changed
keep_session
The text was updated successfully, but these errors were encountered:
Add zopefoundation#5 test for keep_session bug
c9b24cb
keep_session=True
628e09a
No branches or pull requests
A simple script to reproduce
After looking into the code, this is caused by
join_transaction
inmark_changed
method doesn't takekeep_session
and pass along properly.The text was updated successfully, but these errors were encountered: