New issue
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
ZopeTransactionExtension breaks sqlalchemy's .merge() when no changes are made #8
Comments
(Note that "sqlite:///memory:" is a file, changing to "sqlite:///:memory:" does not work due to each thread having its own sqlite memory db.) From the README:
This means that the first That difference in behaviour is because SQLAlchemy sessions by default have expire_on_commit=True. When the session is closed rather than committed the instances are not expired. Adding in a manual call to
Possibly zope.sqlalchemy should call |
Thanks for quick response and for explanation! |
Thanks heaps, that was quick! :-) |
Hi there,
I found a very disturbing problem in multi-threaded application. What happens:
This doesn't happen when not using ZopeTransactionExtension (i.e. using only SQLAlchemy and it's session.commit()). Also using ZopeTransactionExtension('changed') fixes the problem.
Sample code below demonstrates the problem (see comments in function thread_2). Only dependencies are sqlalchemy and zope.sqlalchemy, it uses in-memory slqite.
The problem was observed on SQLAlchemy 8.1 and also the latest 9.4 (haven't tested any other versions), Zope version 0.7.2 and latest 0.7.4.
SQLite is used in the example, but the same problem happens on postgresql, too.
The text was updated successfully, but these errors were encountered: