all Python 3sqlite3exception
sqlite3.DataError
exceptions
A subclass of sqlite3.DatabaseError raised for errors caused by the processed data itself — numeric values out of range, strings that are too long.
Syntax
sqlite3.DataError
The module raises it when SQLite rejects the data itself: a string or BLOB longer than the limit (SQLITE_TOOBIG, "string or blob too big"). An integer too large for SQLite gives OverflowError, not DataError, so catch sqlite3.Error or DatabaseError rather than this class alone.
Examples
import sqlite3
print(issubclass(sqlite3.DataError, sqlite3.DatabaseError)) # → True
print(issubclass(sqlite3.DataError, sqlite3.Error)) # → True
print(sqlite3.DataError.__name__) # → DataError
print(isinstance(sqlite3.DataError('слишком длинная строка'), sqlite3.DatabaseError)) # → True
print(sqlite3.DataError.__mro__[1].__name__) # → DatabaseError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy