Return the current **actual** isolation level that's present on the database within the scope of this connection. This attribute will perform a live SQL operation against the database in order to procure the current isolation level, so the value returned is the actua
(self)
| 604 | return self._dbapi_connection |
| 605 | |
| 606 | def get_isolation_level(self) -> IsolationLevel: |
| 607 | """Return the current **actual** isolation level that's present on |
| 608 | the database within the scope of this connection. |
| 609 | |
| 610 | This attribute will perform a live SQL operation against the database |
| 611 | in order to procure the current isolation level, so the value returned |
| 612 | is the actual level on the underlying DBAPI connection regardless of |
| 613 | how this state was set. This will be one of the four actual isolation |
| 614 | modes ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, |
| 615 | ``SERIALIZABLE``. It will **not** include the ``AUTOCOMMIT`` isolation |
| 616 | level setting. Third party dialects may also feature additional |
| 617 | isolation level settings. |
| 618 | |
| 619 | .. note:: This method **will not report** on the ``AUTOCOMMIT`` |
| 620 | isolation level, which is a separate :term:`dbapi` setting that's |
| 621 | independent of **actual** isolation level. When ``AUTOCOMMIT`` is |
| 622 | in use, the database connection still has a "traditional" isolation |
| 623 | mode in effect, that is typically one of the four values |
| 624 | ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, |
| 625 | ``SERIALIZABLE``. |
| 626 | |
| 627 | Compare to the :attr:`_engine.Connection.default_isolation_level` |
| 628 | accessor which returns the isolation level that is present on the |
| 629 | database at initial connection time. |
| 630 | |
| 631 | .. seealso:: |
| 632 | |
| 633 | :attr:`_engine.Connection.default_isolation_level` |
| 634 | - view default level |
| 635 | |
| 636 | :paramref:`_sa.create_engine.isolation_level` |
| 637 | - set per :class:`_engine.Engine` isolation level |
| 638 | |
| 639 | :paramref:`.Connection.execution_options.isolation_level` |
| 640 | - set per :class:`_engine.Connection` isolation level |
| 641 | |
| 642 | """ |
| 643 | dbapi_connection = self.connection.dbapi_connection |
| 644 | assert dbapi_connection is not None |
| 645 | try: |
| 646 | return self.dialect.get_isolation_level(dbapi_connection) |
| 647 | except BaseException as e: |
| 648 | self._handle_dbapi_exception(e, None, None, None, None) |
| 649 | |
| 650 | @property |
| 651 | def default_isolation_level(self) -> Optional[IsolationLevel]: |