Here's an example of using SQLAlchemy with Twisted— no guarantees on it's the best way to do things, but it works.
def checkIfNodeExists(nodeId):
def threadFunction():
s = Session()
r = s.query(Node).filter(Node.NodeId == nodeId).count()
if r is not 0:
return True
else:
return False
return threads.deferToThread(threadFunction)
It would be really beneficial if this were something that fully works with twisted, but is not dependent on it.
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.
Having a great ORM for twisted is wonderful , but its way less exciting and attractive if it's only for twisted.
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python