@amalinov

При любом взаимодействии с БД (SQLite) выдает ошибку. Как это исправить?

Форум написан на питоне. Фреймворк - Фласк.
С БД работаю в DB Browser for SQLite
Произвожу любое изменение в sqlitebrowser, получаю такой Трешбек:
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)]

Что может быть не так?
  • Вопрос задан
  • 2218 просмотров
Пригласить эксперта
Ответы на вопрос 1
MaxDukov
@MaxDukov
впишусь в проект как SRE/DevOps.
OperationalError: (sqlite3.OperationalError) database is locked
кто-то уже пишет в БД, транзакцию начал и не закоммитил.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы