Hi, the example below demonstrates a bad side-effect of sqlhub.doInTransaction(). I suppose the problem is, that doInTransaction() restores the old connection unconditionally to sqlhub.threadConnection, although self.getConnection() returns sqlhub.processConnection in case it is set. And since doInTransaction() sets sqlhub.threadConnection, changing sqlhub.processConnection afterwards has no effect anymore.
Kind regards, Markus Test-script: ---- from sqlobject import * class Person(SQLObject): name = StringCol() def switchDB(uri): sqlhub.processConnection = connectionForURI(uri) def cleanupDB(uri): switchDB(uri) Person.dropTable(ifExists=True) Person.createTable(ifNotExists=True) def test(name): p = Person(name=name) print Person.get(1) print 'OK:' cleanupDB('sqlite:/test1.db3') cleanupDB('sqlite:/test2.db3') switchDB('sqlite:/test1.db3') test('John') switchDB('sqlite:/test2.db3') test('Doe') print 'Bug:' cleanupDB('sqlite:/test1.db3') cleanupDB('sqlite:/test2.db3') switchDB('sqlite:/test1.db3') sqlhub.doInTransaction(test, 'John') switchDB('sqlite:/test2.db3') # has no effect anymore test('Doe') # prints <Person 1 name='John'> from test1.db3 ---- Output: OK: <Person 1 name='John'> <Person 1 name='Doe'> Bug: <Person 1 name='John'> <Person 1 name='John'> ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss