r"""Construct a new :class:`_asyncio.AsyncSession`. All parameters other than ``sync_session_class`` are passed to the ``sync_session_class`` callable directly to instantiate a new :class:`_orm.Session`. Refer to :meth:`_orm.Session.__init__` for parameter documentat
(
self,
bind: Optional[_AsyncSessionBind] = None,
*,
binds: Optional[Dict[_SessionBindKey, _AsyncSessionBind]] = None,
sync_session_class: Optional[Type[Session]] = None,
**kw: Any,
)
| 230 | dispatch: dispatcher[Session] |
| 231 | |
| 232 | def __init__( |
| 233 | self, |
| 234 | bind: Optional[_AsyncSessionBind] = None, |
| 235 | *, |
| 236 | binds: Optional[Dict[_SessionBindKey, _AsyncSessionBind]] = None, |
| 237 | sync_session_class: Optional[Type[Session]] = None, |
| 238 | **kw: Any, |
| 239 | ): |
| 240 | r"""Construct a new :class:`_asyncio.AsyncSession`. |
| 241 | |
| 242 | All parameters other than ``sync_session_class`` are passed to the |
| 243 | ``sync_session_class`` callable directly to instantiate a new |
| 244 | :class:`_orm.Session`. Refer to :meth:`_orm.Session.__init__` for |
| 245 | parameter documentation. |
| 246 | |
| 247 | :param sync_session_class: |
| 248 | A :class:`_orm.Session` subclass or other callable which will be used |
| 249 | to construct the :class:`_orm.Session` which will be proxied. This |
| 250 | parameter may be used to provide custom :class:`_orm.Session` |
| 251 | subclasses. Defaults to the |
| 252 | :attr:`_asyncio.AsyncSession.sync_session_class` class-level |
| 253 | attribute. |
| 254 | |
| 255 | .. versionadded:: 1.4.24 |
| 256 | |
| 257 | """ |
| 258 | sync_bind = sync_binds = None |
| 259 | |
| 260 | if bind: |
| 261 | self.bind = bind |
| 262 | sync_bind = engine._get_sync_engine_or_connection(bind) |
| 263 | |
| 264 | if binds: |
| 265 | self.binds = binds |
| 266 | sync_binds = { |
| 267 | key: engine._get_sync_engine_or_connection(b) |
| 268 | for key, b in binds.items() |
| 269 | } |
| 270 | |
| 271 | if sync_session_class: |
| 272 | self.sync_session_class = sync_session_class |
| 273 | |
| 274 | self.sync_session = self._proxied = self._assign_proxied( |
| 275 | self.sync_session_class(bind=sync_bind, binds=sync_binds, **kw) |
| 276 | ) |
| 277 | |
| 278 | sync_session_class: Type[Session] = Session |
| 279 | """The class or callable that provides the |
nothing calls this directly
no test coverage detected