The SQLite dialect uses a "thread local" scoped connection pool by default. In 0.7 file-based SQLite databases will start using NullPool by default.
http://www.sqlalchemy.org/trac/wiki/FAQ#IamusingmultipleconnectionswithaSQLitedatabasetypicallytotesttransactionoperationandmytestprogramisnotworking http://www.sqlalchemy.org/docs/dialects/sqlite.html#threading-behavior http://www.sqlalchemy.org/docs/core/pooling.html#sqlalchemy.pool.SingletonThreadPool On Dec 16, 2010, at 6:55 AM, Ralph Heinkel wrote: > Hi, > > can anybody explain to me why the update statement on conn1 below is not > rolled back? conn2 should be in autocommit mode, but why does it commit > transactions of conn1? > > Any help could be appreciated. > > Thanks > > Ralph > > --------------- > > from sqlalchemy import * > engine = create_engine('sqlite:///s.db', echo=True) > > conn0 = engine.connect() > conn1 = engine.connect() > conn2 = engine.connect() > > conn0.execute('create table atesttable (id int, name varchar(20))') > conn0.execute("insert into atesttable (id, name) values (1, 'otto')") > conn0.execute("insert into atesttable (id, name) values (2, 'gustav')") > > tr = conn1.begin() > conn1.execute("update atesttable set name='ottox28' where id=1") > conn2.execute("update atesttable set name='gustavXX' where id=2") > tr.rollback() > > assert conn0.execute("select name from atesttable where id=1").fetchone()[0] > == 'otto' # <--- this fails!! > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
