MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / async_engine_from_config

Function async_engine_from_config

lib/sqlalchemy/ext/asyncio/engine.py:130–152  ·  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

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