Skip to content

Exceptions

mydborm.exceptions.MydbormError

Bases: Exception

Base exception for all mydborm errors. Catch this to handle any mydborm-related error.

Usage

try: User.create(username="alice") except MydbormError as e: print(f"ORM error: {e}")

mydborm.exceptions.BulkInsertError

Bases: BulkOperationError

Raised when bulk_create fails on one or more chunks.

mydborm.exceptions.ValidationError

Bases: MydbormError

Raised when field validation fails before a DB operation.

Attributes:

Name Type Description
field

the field name that failed

value

the value that was rejected

reason

human-readable reason

mydborm.exceptions.SchemaError

Bases: MydbormError

Raised when model schema doesn't match the live database.

Attributes:

Name Type Description
table

table name with the mismatch

missing_columns

columns in model but not in DB

extra_columns

columns in DB but not in model