twisted.enterprise.adbapi is the traditional way - it presents a non-blocking API to databases by using a thread-pool. http://itamarst.org/writings/etech04/twisted_internet-91.html has some examples.