If I am reading this properly, you want to create a new instance if db for each thread? I have never tried this before, but could you do something like this for each thread?
db_thread = DAL(db._uri) for k, v in db.items(): db_thread[k] = v The idea being to using the existing db's URI string to make a new DAL instance, then copying the table information from db to db_thread. Again, I don't know if this works, but it might point in the right direction unless someone else has a more elegant solution.