I have a python script which uses the latest sqlalchemy. When i use sqlite,only sqlite, other db works well, i get the following error:
sqlalchemy.exc.OperationalError: (OperationalError) database is locked u'SELECT blabla....
Any hint?
Example from my code (simplified), i have several methods like this, to select, update and delete things:
class MyDb(object):
def __init__(self):
engine = create_engine("sqlite:///file", poolclass=NullPool, pool_threadlocal=True)
engine.pool_size=1
engine.pool_timeout = 60
self.sess = sessionmaker(bind=engine)
def del_stuff(self):
sess = self.sess()
sess.query(Stuff).delete()
try:
sess.commit()
except:
sess.rollback()
def set_stuff(self, id, bar):
sess = self.sess()
sess.query(Foo).get(id).bar = bar
try:
sess.commit()
except:
sess.rollback()