&gt; Hi,<br>&gt;<br>&gt; In response to the announcement of the Twisted Asynchronous Database Api<br>&gt; (tada), &lt;<a href="http://www.darkarts.co.za/projects/tada/">http://www.darkarts.co.za/projects/tada/</a>, I thought I should<br>
&gt; mention something I wrote.<br>&gt;<br>&gt; [Unfortunately, tada does not use threads correctly so it&#39;s likely to<br>&gt; break. The author knows this and has added a warning to the module for now.]<br>&gt;<br>&gt; A while back, I started messing around with making a standard, blocking<br>
&gt; db-api module appear non-blocking but with a deferred API. I called it<br>&gt; laxdb and it&#39;s in my sandbox.<br>&gt;<br>&gt;     svn://<a href="http://svn.twistedmatrix.com/svn/Twisted/sandbox/mg/laxdb.py">svn.twistedmatrix.com/svn/Twisted/sandbox/mg/laxdb.py</a><br>
&gt;     <a href="http://svn.twistedmatrix.com/cvs/sandbox/mg/laxdb.py?view=markup">http://svn.twistedmatrix.com/cvs/sandbox/mg/laxdb.py?view=markup</a><br>&gt;<br>&gt; laxdb is quite literally an async db-api interface and not a<br>
&gt; t.enterprise.adbapi style interface. In particular, it provides exactly<br>&gt; the same API (but deferred) and it doesn&#39;t take over transaction<br>&gt; management. It also doesn&#39;t wrongly call a cursor, &quot;Transaction&quot; ;-).<br>
&gt;<br>&gt; I recently went back to laxdb and finished it off, also adding a<br>&gt; connection pool implementation.<br>&gt;<br>&gt; Now, I haven&#39;t used laxdb in a real project and there are no unit tests<br>&gt; but I think it&#39;s reasonably complete. It should work with any dbapi<br>
&gt; module that has threadsafety level 1 or higher, just like adbapi.<br>&gt;<br>&gt; If there&#39;s interest in this way of accessing a database then I would be<br>&gt; happy to write tests etc, move it into Twisted and maintain it.<br>
&gt;<br>&gt; Cheers, Matt<br><br>I guess there have not been any additions to this module in recent time.<br>I just tried to use it, sample code, actually a failure test, is as below which does not actually do any query. Reactor is stopped without commit or rollback. <br>
This raises an exception in removeTrigger_BASE.<br>    exceptions.ValueError: list.remove(x): x not in list<br><br>I could fix it, in class WorkerThread, function _start has line<br>    self._shutdownTriggerId = reactor.addSystemEventTrigger(&#39;after&#39;, &#39;shutdown&#39;, self.shutdown)<br>
<br>self.shutdown is called by Connection.close() or reactor.stop(). In case of second, reactor.stop, registered function, self.shutdown in this case, should not do <br>    reactor.removeSystemEventTrigger(self._shutdownTriggerId) <br>
<br>However, this raises some doubts about overall code as there are no test cases to prove the correctness.<br>Has anyone used this before? Can somebody provide pointers on what scenarios/conditions should be tested?<br>
laxdb is good match for what I want, interleaved calls and async interface to db. Is there any alternative available?<br><br>[code]<br>from laxdb import ConnectionPool<br>from twisted.internet import reactor<br><br>pool = ConnectionPool(&quot;sqlite3&quot;, database=&#39;laxdbTest&#39;, timeout=5.0, check_same_thread=False)<br>
<br>def connect(pool):<br>    d = pool.connect()<br>    d.addCallback(connected)<br><br>def connected(conn):<br>    curs = conn.cursor()<br>    reactor.stop()<br><br>reactor.callWhenRunning(connect, pool)<br>reactor.run()<br>
[/code]<br><br>Regards,<br>vishal<br>