An error occurred during execution of a SQL statement. :class:`StatementError` wraps the exception raised during execution, and features :attr:`.statement` and :attr:`.params` attributes which supply context regarding the specifics of the statement which had an issue. The wrapp
| 493 | |
| 494 | |
| 495 | class StatementError(SQLAlchemyError): |
| 496 | """An error occurred during execution of a SQL statement. |
| 497 | |
| 498 | :class:`StatementError` wraps the exception raised |
| 499 | during execution, and features :attr:`.statement` |
| 500 | and :attr:`.params` attributes which supply context regarding |
| 501 | the specifics of the statement which had an issue. |
| 502 | |
| 503 | The wrapped exception object is available in |
| 504 | the :attr:`.orig` attribute. |
| 505 | |
| 506 | """ |
| 507 | |
| 508 | statement: Optional[str] = None |
| 509 | """The string SQL statement being invoked when this exception occurred.""" |
| 510 | |
| 511 | params: Optional[_AnyExecuteParams] = None |
| 512 | """The parameter list being used when this exception occurred.""" |
| 513 | |
| 514 | orig: Optional[BaseException] = None |
| 515 | """The original exception that was thrown. |
| 516 | |
| 517 | .. seealso:: |
| 518 | |
| 519 | :attr:`.DBAPIError.driver_exception` - a more specific attribute that |
| 520 | is guaranteed to return the exception object raised by the third |
| 521 | party driver in use, even when using asyncio. |
| 522 | |
| 523 | """ |
| 524 | |
| 525 | ismulti: Optional[bool] = None |
| 526 | """multi parameter passed to repr_params(). None is meaningful.""" |
| 527 | |
| 528 | connection_invalidated: bool = False |
| 529 | |
| 530 | def __init__( |
| 531 | self, |
| 532 | message: str, |
| 533 | statement: Optional[str], |
| 534 | params: Optional[_AnyExecuteParams], |
| 535 | orig: Optional[BaseException], |
| 536 | hide_parameters: bool = False, |
| 537 | code: Optional[str] = None, |
| 538 | ismulti: Optional[bool] = None, |
| 539 | ): |
| 540 | SQLAlchemyError.__init__(self, message, code=code) |
| 541 | self.statement = statement |
| 542 | self.params = params |
| 543 | self.orig = orig |
| 544 | self.ismulti = ismulti |
| 545 | self.hide_parameters = hide_parameters |
| 546 | self.detail: List[str] = [] |
| 547 | |
| 548 | def add_detail(self, msg: str) -> None: |
| 549 | self.detail.append(msg) |
| 550 | |
| 551 | def __reduce__(self) -> Union[str, Tuple[Any, ...]]: |
| 552 | return ( |