class documentation

An asyncio proxy for a :class:`_engine.Engine`. :class:`_asyncio.AsyncEngine` is acquired using the :func:`_asyncio.create_async_engine` function:: from sqlalchemy.ext.asyncio import create_async_engine engine = create_async_engine("postgresql+asyncpg://user:pass@host/dbname") .. versionadded:: 1.4

Method __init__ Undocumented
Async Method begin Return a context manager which when entered will deliver an :class:`_asyncio.AsyncConnection` with an :class:`_asyncio.AsyncTransaction` established.
Method clear_compiled_cache Clear the compiled cache associated with the dialect.
Method connect Return an :class:`_asyncio.AsyncConnection` object.
Method dialect.setter Undocumented
Async Method dispose Dispose of the connection pool used by this :class:`_asyncio.AsyncEngine`.
Method echo.setter Undocumented
Method execution_options Return a new :class:`_asyncio.AsyncEngine` that will provide :class:`_asyncio.AsyncConnection` objects with the given execution options.
Method get_execution_options Get the non-SQL options which will take effect during execution.
Method pool.setter Undocumented
Async Method raw_connection Return a "raw" DBAPI connection from the connection pool.
Method update_execution_options Update the default execution_options dictionary of this :class:`_engine.Engine`.
Method url.setter Undocumented
Class Variable __slots__ Undocumented
Instance Variable sync_engine Reference to the sync-style :class:`_engine.Engine` this :class:`_asyncio.AsyncEngine` proxies requests towards.
Property dialect Proxy for the :attr:`_engine.Engine.dialect` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.
Property driver Driver name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`.
Property echo When ``True``, enable log output for this element.
Property engine Returns this :class:`.Engine`.
Property name String name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`.
Property pool Proxy for the :attr:`_engine.Engine.pool` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.
Property url Proxy for the :attr:`_engine.Engine.url` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.
Class Method _regenerate_proxy_for_target Undocumented
Property _proxied Undocumented

Inherited from ProxyComparable:

Method __eq__ Undocumented
Method __hash__ Undocumented
Method __ne__ Undocumented

Inherited from ReversibleProxy (via ProxyComparable):

Class Method _retrieve_proxy_for_target Undocumented
Class Method _target_gced Undocumented
Method _assign_proxied Undocumented
Class Variable _proxy_objects Undocumented

Inherited from AsyncConnectable (via ProxyComparable, ReversibleProxy):

Class Method _no_async_engine_events Undocumented
def __init__(self, sync_engine: Engine): (source)

Undocumented

Return a context manager which when entered will deliver an :class:`_asyncio.AsyncConnection` with an :class:`_asyncio.AsyncTransaction` established. E.g.:: async with async_engine.begin() as conn: await conn.execute( text("insert into table (x, y, z) values (1, 2, 3)") ) await conn.execute(text("my_special_procedure(5)"))

def clear_compiled_cache(self): (source)

Clear the compiled cache associated with the dialect. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class. This applies **only** to the built-in cache that is established via the :paramref:`_engine.create_engine.query_cache_size` parameter. It will not impact any dictionary caches that were passed via the :paramref:`.Connection.execution_options.query_cache` parameter. .. versionadded:: 1.4

def connect(self) -> AsyncConnection: (source)

Return an :class:`_asyncio.AsyncConnection` object. The :class:`_asyncio.AsyncConnection` will procure a database connection from the underlying connection pool when it is entered as an async context manager:: async with async_engine.connect() as conn: result = await conn.execute(select(user_table)) The :class:`_asyncio.AsyncConnection` may also be started outside of a context manager by invoking its :meth:`_asyncio.AsyncConnection.start` method.

@dialect.setter
def dialect(self, attr: Dialect): (source)

Undocumented

async def dispose(self, close: bool = True): (source)

Dispose of the connection pool used by this :class:`_asyncio.AsyncEngine`. :param close: if left at its default of ``True``, has the effect of fully closing all **currently checked in** database connections. Connections that are still checked out will **not** be closed, however they will no longer be associated with this :class:`_engine.Engine`, so when they are closed individually, eventually the :class:`_pool.Pool` which they are associated with will be garbage collected and they will be closed out fully, if not already closed on checkin. If set to ``False``, the previous connection pool is de-referenced, and otherwise not touched in any way. .. seealso:: :meth:`_engine.Engine.dispose`

@echo.setter
def echo(self, attr: Any): (source)

Undocumented

@overload
def execution_options(self, *, compiled_cache: Optional[CompiledCacheType] = ..., logging_token: str = ..., isolation_level: IsolationLevel = ..., insertmanyvalues_page_size: int = ..., schema_translate_map: Optional[SchemaTranslateMapType] = ..., **opt: Any) -> AsyncEngine:
@overload
def execution_options(self, **opt: Any) -> AsyncEngine:
(source)

Return a new :class:`_asyncio.AsyncEngine` that will provide :class:`_asyncio.AsyncConnection` objects with the given execution options. Proxied from :meth:`_engine.Engine.execution_options`. See that method for details.

def get_execution_options(self) -> _ExecuteOptions: (source)

Get the non-SQL options which will take effect during execution. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class. .. versionadded: 1.3 .. seealso:: :meth:`_engine.Engine.execution_options`

@pool.setter
def pool(self, attr: Pool): (source)

Undocumented

async def raw_connection(self) -> PoolProxiedConnection: (source)

Return a "raw" DBAPI connection from the connection pool. .. seealso:: :ref:`dbapi_connections`

def update_execution_options(self, **opt: Any): (source)

Update the default execution_options dictionary of this :class:`_engine.Engine`. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class. The given keys/values in \**opt are added to the default execution options that will be used for all connections. The initial contents of this dictionary can be sent via the ``execution_options`` parameter to :func:`_sa.create_engine`. .. seealso:: :meth:`_engine.Connection.execution_options` :meth:`_engine.Engine.execution_options`

@url.setter
def url(self, attr: URL): (source)

Undocumented

sync_engine = (source)

Reference to the sync-style :class:`_engine.Engine` this :class:`_asyncio.AsyncEngine` proxies requests towards. This instance can be used as an event target. .. seealso:: :ref:`asyncio_events`

Proxy for the :attr:`_engine.Engine.dialect` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.

Driver name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class.

When ``True``, enable log output for this element. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class. This has the effect of setting the Python logging level for the namespace of this element's class and object reference. A value of boolean ``True`` indicates that the loglevel ``logging.INFO`` will be set for the logger, whereas the string value ``debug`` will set the loglevel to ``logging.DEBUG``.

Returns this :class:`.Engine`. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class. Used for legacy schemes that accept :class:`.Connection` / :class:`.Engine` objects within the same variable.

String name of the :class:`~sqlalchemy.engine.interfaces.Dialect` in use by this :class:`Engine`. .. container:: class_bases Proxied for the :class:`_engine.Engine` class on behalf of the :class:`_asyncio.AsyncEngine` class.

Proxy for the :attr:`_engine.Engine.pool` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.

Proxy for the :attr:`_engine.Engine.url` attribute on behalf of the :class:`_asyncio.AsyncEngine` class.

@classmethod
def _regenerate_proxy_for_target(cls, target: Engine) -> AsyncEngine: (source)
@util.ro_non_memoized_property
_proxied: Engine = (source)