summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/create.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-07 12:01:42 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-07 12:10:40 -0500
commite36496808a93870c07f143b0a17d2b8df224c55d (patch)
treecdb4fd1d994e6325dcb21e84c21ea1145bd9ba90 /lib/sqlalchemy/engine/create.py
parenta289e05226e20cc6de9deb479f63297320ef7c5c (diff)
downloadsqlalchemy-e36496808a93870c07f143b0a17d2b8df224c55d.tar.gz
adapt create_engine from sqlalchemy2-stubs
this is much simplified, will try to see if _IsolationLevel can work out, technically some driver can have custom values here but in practice this might not be a thing Change-Id: I6085ccb559c377fab03c8ce79f0eecb240c56f7a
Diffstat (limited to 'lib/sqlalchemy/engine/create.py')
-rw-r--r--lib/sqlalchemy/engine/create.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/create.py b/lib/sqlalchemy/engine/create.py
index cb5219396..68a6b81e2 100644
--- a/lib/sqlalchemy/engine/create.py
+++ b/lib/sqlalchemy/engine/create.py
@@ -10,9 +10,13 @@ from __future__ import annotations
import inspect
import typing
from typing import Any
+from typing import Callable
from typing import cast
from typing import Dict
+from typing import List
from typing import Optional
+from typing import overload
+from typing import Type
from typing import Union
from . import base
@@ -28,6 +32,61 @@ from ..sql import compiler
if typing.TYPE_CHECKING:
from .base import Engine
+ from .interfaces import _ExecuteOptions
+ from .interfaces import _IsolationLevel
+ from .interfaces import _ParamStyle
+ from .url import URL
+ from ..log import _EchoFlagType
+ from ..pool import _CreatorFnType
+ from ..pool import _CreatorWRecFnType
+ from ..pool import _ResetStyleArgType
+ from ..pool import Pool
+ from ..util.typing import Literal
+
+
+@overload
+def create_engine(
+ url: Union[str, URL],
+ *,
+ connect_args: Dict[Any, Any] = ...,
+ convert_unicode: bool = ...,
+ creator: Union[_CreatorFnType, _CreatorWRecFnType] = ...,
+ echo: _EchoFlagType = ...,
+ echo_pool: _EchoFlagType = ...,
+ enable_from_linting: bool = ...,
+ execution_options: _ExecuteOptions = ...,
+ future: Literal[True],
+ hide_parameters: bool = ...,
+ implicit_returning: bool = ...,
+ isolation_level: _IsolationLevel = ...,
+ json_deserializer: Callable[..., Any] = ...,
+ json_serializer: Callable[..., Any] = ...,
+ label_length: Optional[int] = ...,
+ listeners: Any = ...,
+ logging_name: str = ...,
+ max_identifier_length: Optional[int] = ...,
+ max_overflow: int = ...,
+ module: Optional[Any] = ...,
+ paramstyle: Optional[_ParamStyle] = ...,
+ pool: Optional[Pool] = ...,
+ poolclass: Optional[Type[Pool]] = ...,
+ pool_logging_name: str = ...,
+ pool_pre_ping: bool = ...,
+ pool_size: int = ...,
+ pool_recycle: int = ...,
+ pool_reset_on_return: Optional[_ResetStyleArgType] = ...,
+ pool_timeout: float = ...,
+ pool_use_lifo: bool = ...,
+ plugins: List[str] = ...,
+ query_cache_size: int = ...,
+ **kwargs: Any,
+) -> Engine:
+ ...
+
+
+@overload
+def create_engine(url: Union[str, URL], **kwargs: Any) -> Engine:
+ ...
@util.deprecated_params(