zopefoundation / zope.sqlalchemy

Integration of SQLAlchemy with transaction management
Other
32 stars 34 forks source link

cannot import zope.sqlalchemy.ZopeTransactionExtension #37

Closed hemna closed 4 years ago

hemna commented 5 years ago

Just upgraded zope.sqlalchemy from pip and it broke the world.


    from zope.sqlalchemy import ZopeTransactionExtension
ImportError: cannot import name 'ZopeTransactionExtension' from 'zope.sqlalchemy'
chrisgeru commented 5 years ago

Can you please confirm if we can change this:

DBSession = scoped_session(
sessionmaker(autoflush=False, 
extension=ZopeTransactionExtension()))

to this:

from zope.sqlalchemy import register

DBSession = scoped_session(sessionmaker(autoflush=False))
register(DBSession)
leplatrem commented 5 years ago

Yes, this should work!

mgedmin commented 5 years ago

Would anyone care to copy and paste this suggestion into CHANGES.rst and open a pull request?

hemna commented 5 years ago

yes that worked thank you.