Ask coding questions

← Back to all posts
SQLAlchemy Error
Korbindev

sqlalchemy.exc.DatabaseError
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: SELECT user.sno AS user_sno, user.time AS user_time, user.uname AS user_uname, user.email AS user_email, user.password AS user_password
FROM user
WHERE user.sno = ?]
(Background on this error at: https://sqlalche.me/e/14/4xp6)

Traceback (most recent call last)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1799, in _execute_context
self.dialect.do_execute(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
cursor.execute(statement, parameters)
The above exception was the direct cause of the following exception:
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/home/runner/Korbindev/app/routes.py", line 10, in homepage
return render_template("information.html" , )
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/templating.py", line 146, in render_template
ctx.app.update_template_context(context)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 756, in update_template_context
context.update(func())
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_login/utils.py", line 379, in _user_context_processor
return dict(current_user=_get_user())
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_login/utils.py", line 346, in _get_user
current_app.login_manager._load_user()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_login/login_manager.py", line 318, in _load_user
user = self._user_callback(user_id)
File "/home/runner/Korbindev/app/models.py", line 7, in load_user
return User.query.get(int(user_id))
File "<string>", line 2, in get

File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 390, in warned
return fn(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 943, in get
return self.get_impl(ident, loading.load_on_pk_identity)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 947, in _get_impl
return self.session._get_impl(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2869, in _get_impl
return db_load_fn(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 524, in load_on_pk_identity
session.execute(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1689, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1611, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
return connection._execute_clauseelement(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1478, in _execute_clauseelement
ret = self._execute_context(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1842, in _execute_context
self._handle_dbapi_exception(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2023, in _handle_dbapi_exception
util.raise
(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
raise exception
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1799, in _execute_context
self.dialect.do_execute(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: SELECT user.sno AS user_sno, user.time AS user_time, user.uname AS user_uname, user.email AS user_email, user.password AS user_password
FROM user
WHERE user.sno = ?]
(Background on this error at: https://sqlalche.me/e/14/4xp6)
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.

Voters
Korbindev