This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# engine/create.py
|
||||
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
|
||||
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
|
||||
# <see AUTHORS file>
|
||||
#
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
@@ -82,11 +82,13 @@ def create_engine(
|
||||
query_cache_size: int = ...,
|
||||
use_insertmanyvalues: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> Engine: ...
|
||||
) -> Engine:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def create_engine(url: Union[str, URL], **kwargs: Any) -> Engine: ...
|
||||
def create_engine(url: Union[str, URL], **kwargs: Any) -> Engine:
|
||||
...
|
||||
|
||||
|
||||
@util.deprecated_params(
|
||||
@@ -133,11 +135,8 @@ def create_engine(url: Union[str, _url.URL], **kwargs: Any) -> Engine:
|
||||
and its underlying :class:`.Dialect` and :class:`_pool.Pool`
|
||||
constructs::
|
||||
|
||||
engine = create_engine(
|
||||
"mysql+mysqldb://scott:tiger@hostname/dbname",
|
||||
pool_recycle=3600,
|
||||
echo=True,
|
||||
)
|
||||
engine = create_engine("mysql+mysqldb://scott:tiger@hostname/dbname",
|
||||
pool_recycle=3600, echo=True)
|
||||
|
||||
The string form of the URL is
|
||||
``dialect[+driver]://user:password@host/dbname[?key=value..]``, where
|
||||
@@ -468,9 +467,6 @@ def create_engine(url: Union[str, _url.URL], **kwargs: Any) -> Engine:
|
||||
|
||||
:ref:`pool_reset_on_return`
|
||||
|
||||
:ref:`dbapi_autocommit_skip_rollback` - a more modern approach
|
||||
to using connections with no transactional instructions
|
||||
|
||||
:param pool_timeout=30: number of seconds to wait before giving
|
||||
up on getting a connection from the pool. This is only used
|
||||
with :class:`~sqlalchemy.pool.QueuePool`. This can be a float but is
|
||||
@@ -527,18 +523,6 @@ def create_engine(url: Union[str, _url.URL], **kwargs: Any) -> Engine:
|
||||
|
||||
.. versionadded:: 1.4
|
||||
|
||||
:param skip_autocommit_rollback: When True, the dialect will
|
||||
unconditionally skip all calls to the DBAPI ``connection.rollback()``
|
||||
method if the DBAPI connection is confirmed to be in "autocommit" mode.
|
||||
The availability of this feature is dialect specific; if not available,
|
||||
a ``NotImplementedError`` is raised by the dialect when rollback occurs.
|
||||
|
||||
.. seealso::
|
||||
|
||||
:ref:`dbapi_autocommit_skip_rollback`
|
||||
|
||||
.. versionadded:: 2.0.43
|
||||
|
||||
:param use_insertmanyvalues: True by default, use the "insertmanyvalues"
|
||||
execution style for INSERT..RETURNING statements by default.
|
||||
|
||||
@@ -632,14 +616,6 @@ def create_engine(url: Union[str, _url.URL], **kwargs: Any) -> Engine:
|
||||
# assemble connection arguments
|
||||
(cargs_tup, cparams) = dialect.create_connect_args(u)
|
||||
cparams.update(pop_kwarg("connect_args", {}))
|
||||
|
||||
if "async_fallback" in cparams and util.asbool(cparams["async_fallback"]):
|
||||
util.warn_deprecated(
|
||||
"The async_fallback dialect argument is deprecated and will be "
|
||||
"removed in SQLAlchemy 2.1.",
|
||||
"2.0",
|
||||
)
|
||||
|
||||
cargs = list(cargs_tup) # allow mutability
|
||||
|
||||
# look for existing pool or create
|
||||
@@ -681,17 +657,6 @@ def create_engine(url: Union[str, _url.URL], **kwargs: Any) -> Engine:
|
||||
else:
|
||||
pool._dialect = dialect
|
||||
|
||||
if (
|
||||
hasattr(pool, "_is_asyncio")
|
||||
and pool._is_asyncio is not dialect.is_async
|
||||
):
|
||||
raise exc.ArgumentError(
|
||||
f"Pool class {pool.__class__.__name__} cannot be "
|
||||
f"used with {'non-' if not dialect.is_async else ''}"
|
||||
"asyncio engine",
|
||||
code="pcls",
|
||||
)
|
||||
|
||||
# create engine.
|
||||
if not pop_kwarg("future", True):
|
||||
raise exc.ArgumentError(
|
||||
@@ -851,11 +816,13 @@ def create_pool_from_url(
|
||||
timeout: float = ...,
|
||||
use_lifo: bool = ...,
|
||||
**kwargs: Any,
|
||||
) -> Pool: ...
|
||||
) -> Pool:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def create_pool_from_url(url: Union[str, URL], **kwargs: Any) -> Pool: ...
|
||||
def create_pool_from_url(url: Union[str, URL], **kwargs: Any) -> Pool:
|
||||
...
|
||||
|
||||
|
||||
def create_pool_from_url(url: Union[str, URL], **kwargs: Any) -> Pool:
|
||||
|
||||
Reference in New Issue
Block a user