<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I am currently using SQLAlchemy with Twisted with deferToThread and it works rather well, have you tried it? So long as you create a new session for each thread you spawn (which you should also do without Twisted) it works without any modification required.<div><br></div><div>Here's an example of using SQLAlchemy with Twisted— no guarantees on it's the best way to do things, but it works.</div><div><br></div><div><div><font face="Monaco">def checkIfNodeExists(nodeId):</font></div><div><font face="Monaco">    def threadFunction():</font></div><div><font face="Monaco">        s = Session()</font></div><div><font face="Monaco">        r =  s.query(Node).filter(Node.NodeId == nodeId).count()</font></div><div><font face="Monaco">        if r is not 0:</font></div><div><font face="Monaco">            return True</font></div><div><font face="Monaco">        else:</font></div><div><font face="Monaco">            return False</font></div><div><font face="Monaco"><br></font></div><div><font face="Monaco">    return threads.deferToThread(threadFunction)</font></div><div><br></div><div><br></div><div><br></div><div><div>On Aug 21, 2013, at 9:05 PM, Jonathan Vanasco <<a href="mailto:twisted-python@2xlp.com">twisted-python@2xlp.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>It would be really beneficial if this were something that fully works with twisted, but is not dependent on it.<br><br>For example, I have a "Project" that mostly uses SqlAlchemy.  It started out in Pylons, new development is on Pyramid and there are additional tasks in Celery + some more in Twisted.  Aside from a few manual db tasks in Twisted, they all share and re-use a common "Model" package.  <br><br>Having a great ORM for twisted is wonderful , but its way less exciting and attractive if it's only for twisted.<br>_______________________________________________<br>Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python<br></blockquote></div><br></div></body></html>