Database Errors

The Python DB-API 2.0 spec describes several types of exceptions. Because most database drivers have their own implementations of these exceptions, Peewee simplifies things by providing its own wrappers around any implementation-specific exception classes. That way, you don’t need to worry about importing any special exception classes, you can just use the ones from peewee:

  • DatabaseError
  • DataError
  • IntegrityError
  • InterfaceError
  • InternalError
  • NotSupportedError
  • OperationalError
  • ProgrammingError

Note

All of these error classes extend PeeweeException.