errors
Translates native driver exceptions into the SQLAlchemy exceptions the SQLAlchemy execution path raises.
raise_translated(error, *, backend, sa_connection, sql, args, ismulti=False)
async
Re-raise a driver exception as the sqlalchemy.exc exception SQLAlchemy
would raise for it, so user code catches the same errors on both paths::
| Text Only | |
|---|---|
1 2 3 | |
When the dialect recognises the error as a lost connection, the connection is invalidated first, so it is closed instead of going back to the pool for the next query to fail on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
BaseException
|
exception raised by the driver |
required |
backend
|
NativeBackend
|
native backend the statement ran on |
required |
sa_connection
|
AsyncConnection
|
connection the statement ran on |
required |
sql
|
str
|
executed SQL |
required |
args
|
Sequence[Any]
|
driver arguments of the statement (one list per row for batches) |
required |
ismulti
|
bool
|
whether the statement ran once per row of a batch |
False
|
Raises:
| Type | Description |
|---|---|
sqlalchemy.exc.DBAPIError
|
always |
Source code in ormar/databases/native/errors.py
| Python | |
|---|---|
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |