A
A
amalinov2016-10-24 10:32:54
Debian
amalinov, 2016-10-24 10:32:54

Any interaction with the database (SQLite) gives an error. How to fix it?

The forum is written in python. Framework - Flask.
I work with the database in DB Browser for SQLite
. I make any change in sqlitebrowser, I get this Treshback:

Traceback (most recent call last):
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1637, in full_dispatch_request
    rv = self.preprocess_request()
  File "/root/flaskbb/lib/python2.7/site-packages/flask/app.py", line 1837, in preprocess_request
    rv = func()
  File "/root/flaskbb/flaskbb/app.py", line 243, in update_lastseen
    db.session.commit()
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 157, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 874, in commit
    self.transaction.commit()
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 461, in commit
    self._prepare_impl()
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
    self.session.flush()
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2136, in flush
    self._flush(objects)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2254, in _flush
    transaction.rollback(_capture_exception=True)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2218, in _flush
    flush_context.execute()
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 386, in execute
    rec.execute(self)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 545, in execute
    uow
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 172, in save_obj
    mapper, table, update)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 726, in _emit_update_statements
    execute(statement, multiparams)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
    exc_info
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/root/flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 462, in do_execute
    cursor.execute(statement, parameters)
OperationalError: (sqlite3.OperationalError) database is locked [SQL: u'UPDATE users SET lastseen=? WHERE users.id = ?'] [parameters: ('2016-10-24 07:21:13.910348', 1)]

What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2016-10-24
@MaxDukov

OperationalError: (sqlite3.OperationalError) database is locked
someone already writes to the database, started the transaction and did not commit it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question