On this page
sqlite3.DatabaseError
Prev: sqlite3.Cursor | Up: sqlite3 | Next: sqlite3.DataError
Rel: sqlite3.adapt, sqlite3.Binary, sqlite3.Blob, sqlite3.complete_statement
Ref: docs.python.org โ sqlite3.DatabaseError
Tags: #public #python3 #stdlib #sqlite3
Import
import sqlite3
from sqlite3 import DatabaseError
Signature & Overview
sqlite3.DatabaseError(...)
sqlite3.DatabaseError class.
Methods & Attributes
DatabaseError.add_note(self, note, /)โ Add a note to the exceptionDatabaseError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import sqlite3
con = sqlite3.connect(":memory:")
try:
con.execute("SELECT * FROM missing_table")
except sqlite3.DatabaseError as exc:
assert "missing_table" in str(exc)
finally:
con.close()
Gotchas
- Parent class for most SQLite runtime errors: Covers
OperationalError,IntegrityError,ProgrammingError,DataError,InternalError, andNotSupportedError.
REPL Inspect
from sqlite3 import DatabaseError
help(DatabaseError)
Linked from
Related notes
- tuts/python3/stdlib_module/sqlite3 Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/Cursor Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/DataError Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/adapt Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/Binary Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/Blob Linked here; shared tags: #stdlib
- tuts/python3/stdlib_module/sqlite3/complete_statement Linked here; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib