Matthew Newville
unread,Nov 10, 2011, 11:59:33 AM11/10/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlal...@googlegroups.com
Michael,
Thanks! Using create_engine(..., poolclass=SingletonThreadPool) works perfectly, though create_engine(..., pool_threadlocal=True) still showed similar database is locked on 'session commit'
FWIW, I do have a single engine, connection, and session in the application, as with (now):
self.engine = create_engine('sqlite:///%s' % dbname,
poolclass=SingletonThreadPool)
self.conn = self.engine.connect()
self.session = sessionmaker(bind=self.engine)()
self.metadata = MetaData(self.engine)
self.metadata.reflect()
I haven't been rigorous in checking that only one wxPython thread is using the connection, as the wx code has lots of wx.CallAfter() to allow callbacks from the networking library to call into wx code, which then might want to write into the database. My suspicion is that this is the root cause of the issue.
Anyway, I very much appreciate the quick, helpful response and fantastic library.
--Matt