r"""Return a :class:`_asyncio.AsyncConnection` object corresponding to this :class:`.Session` object's transactional state. This method may also be used to establish execution options for the database connection used by the current transaction. .. versionadded:: 1.4
(
self,
bind_arguments: Optional[_BindArguments] = None,
execution_options: Optional[CoreExecuteOptionsParameter] = None,
**kw: Any,
)
| 952 | ) |
| 953 | |
| 954 | async def connection( |
| 955 | self, |
| 956 | bind_arguments: Optional[_BindArguments] = None, |
| 957 | execution_options: Optional[CoreExecuteOptionsParameter] = None, |
| 958 | **kw: Any, |
| 959 | ) -> AsyncConnection: |
| 960 | r"""Return a :class:`_asyncio.AsyncConnection` object corresponding to |
| 961 | this :class:`.Session` object's transactional state. |
| 962 | |
| 963 | This method may also be used to establish execution options for the |
| 964 | database connection used by the current transaction. |
| 965 | |
| 966 | .. versionadded:: 1.4.24 Added \**kw arguments which are passed |
| 967 | through to the underlying :meth:`_orm.Session.connection` method. |
| 968 | |
| 969 | .. seealso:: |
| 970 | |
| 971 | :meth:`_orm.Session.connection` - main documentation for |
| 972 | "connection" |
| 973 | |
| 974 | """ |
| 975 | |
| 976 | sync_connection = await greenlet_spawn( |
| 977 | self.sync_session.connection, |
| 978 | bind_arguments=bind_arguments, |
| 979 | execution_options=execution_options, |
| 980 | **kw, |
| 981 | ) |
| 982 | return engine.AsyncConnection._retrieve_proxy_for_target( |
| 983 | sync_connection |
| 984 | ) |
| 985 | |
| 986 | def begin(self) -> AsyncSessionTransaction: |
| 987 | """Return an :class:`_asyncio.AsyncSessionTransaction` object. |