MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / async_engine_from_config

Function async_engine_from_config

lib/sqlalchemy/ext/asyncio/engine.py:124–146  ·  view source on GitHub ↗

Create a new AsyncEngine instance using a configuration dictionary. This function is analogous to the :func:`_sa.engine_from_config` function in SQLAlchemy Core, except that the requested dialect must be an asyncio-compatible dialect such as :ref:`dialect-postgresql-asyncpg`. The ar

(
    configuration: Dict[str, Any], prefix: str = "sqlalchemy.", **kwargs: Any
)

Source from the content-addressed store, hash-verified

122
123
124def async_engine_from_config(
125 configuration: Dict[str, Any], prefix: str = "sqlalchemy.", **kwargs: Any
126) -> AsyncEngine:
127 """Create a new AsyncEngine instance using a configuration dictionary.
128
129 This function is analogous to the :func:`_sa.engine_from_config` function
130 in SQLAlchemy Core, except that the requested dialect must be an
131 asyncio-compatible dialect such as :ref:`dialect-postgresql-asyncpg`.
132 The argument signature of the function is identical to that
133 of :func:`_sa.engine_from_config`.
134
135 .. versionadded:: 1.4.29
136
137 """
138 options = {
139 key[len(prefix) :]: value
140 for key, value in configuration.items()
141 if key.startswith(prefix)
142 }
143 options["_coerce_config"] = True
144 options.update(kwargs)
145 url = options.pop("url")
146 return create_async_engine(url, **options)
147
148
149def create_async_pool_from_url(url: Union[str, URL], **kwargs: Any) -> Pool:

Callers 1

Calls 5

create_async_engineFunction · 0.85
itemsMethod · 0.45
startswithMethod · 0.45
updateMethod · 0.45
popMethod · 0.45

Tested by 1