Peewee 简明教程
Peewee - Database Errors
Python 的 DB-API 标准(PEP 249 建议)指定了任何 DB-API 兼容模块(如 pymysql、pyscopg2 等)要定义的异常类类型。
Python’s DB-API standard (recommended by PEP 249) specifies the types of Exception classes to be defined by any DB-API compliant module (such as pymysql, pyscopg2, etc.).
Peewee API 为这些异常提供了易于使用的包装器。 PeeweeException 是 Peewee API 中定义了以下 Exception 类的基类 −
Peewee API provides easy-to-use wrappers for these exceptions. PeeweeException is the base classes from which following Exception classes has been defined in Peewee API −
-
DatabaseError
-
DataError
-
IntegrityError
-
InterfaceError
-
InternalError
-
NotSupportedError
-
OperationalError
-
ProgrammingError
我们可以从 Peewee 实现上述异常,而不是尝试 DB-API 特定的异常。
Instead of DB-API specific exceptions to be tried, we can implement above ones from Peewee.