diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-03-10 11:57:00 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-03-12 11:42:50 -0500 |
| commit | 4c28867f944637ef313f98d5f09da05255418c6d (patch) | |
| tree | f68776450fc91df8085446d517020603b879d0f8 /lib/sqlalchemy/engine/interfaces.py | |
| parent | 03989d1dce80999bb9ea1a7d36df3285e5ce4c3b (diff) | |
| download | sqlalchemy-4c28867f944637ef313f98d5f09da05255418c6d.tar.gz | |
additional mypy strictness
enable type checking within untyped defs. This allowed
some more internals to be fixed up with assertions etc.
some internals that were unnecessary or not even used
at all were removed. BaseCursorResult was no longer
necessary since we only have one kind of CursorResult
now. The different ResultProxy subclasses that had
alternate "strategies" dont appear to be used at all
even in 1.4.x, as there's no code that accesses the
_cursor_strategy_cls attribute, which is also removed.
As these were mostly private constructs that weren't
even functioning correctly in any case,
it's fine to remove these over the 2.0 boundary.
Change-Id: Ifd536987d104b1cd8b546cefdbd5c1e5d1801082
Diffstat (limited to 'lib/sqlalchemy/engine/interfaces.py')
| -rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 5aefcf5b5..e65546eb7 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -36,7 +36,6 @@ from ..sql.compiler import TypeCompiler as TypeCompiler from ..sql.compiler import TypeCompiler # noqa from ..util import immutabledict from ..util.concurrency import await_only -from ..util.typing import _TypeToInstance from ..util.typing import Literal from ..util.typing import NotRequired from ..util.typing import Protocol @@ -58,6 +57,8 @@ if TYPE_CHECKING: from ..sql.elements import ClauseElement from ..sql.schema import Column from ..sql.schema import ColumnDefault + from ..sql.schema import Sequence as Sequence_SchemaItem + from ..sql.sqltypes import Integer from ..sql.type_api import TypeEngine ConnectArgsType = Tuple[Tuple[str], MutableMapping[str, Any]] @@ -156,6 +157,8 @@ class DBAPICursor(Protocol): arraysize: int + lastrowid: int + def close(self) -> None: ... @@ -196,6 +199,7 @@ class DBAPICursor(Protocol): _CoreSingleExecuteParams = Mapping[str, Any] +_MutableCoreSingleExecuteParams = MutableMapping[str, Any] _CoreMultiExecuteParams = Sequence[_CoreSingleExecuteParams] _CoreAnyExecuteParams = Union[ _CoreMultiExecuteParams, _CoreSingleExecuteParams @@ -605,7 +609,7 @@ class Dialect(EventTarget): ddl_compiler: Type[DDLCompiler] """a :class:`.Compiled` class used to compile DDL statements""" - type_compiler: _TypeToInstance[TypeCompiler] + type_compiler: Union[Type[TypeCompiler], TypeCompiler] """a :class:`.Compiled` class used to compile SQL type objects""" preparer: Type[IdentifierPreparer] @@ -633,7 +637,7 @@ class Dialect(EventTarget): """ - default_isolation_level: _IsolationLevel + default_isolation_level: Optional[_IsolationLevel] """the isolation that is implicitly present on new connections""" execution_ctx_cls: Type["ExecutionContext"] @@ -653,6 +657,13 @@ class Dialect(EventTarget): max_identifier_length: int """The maximum length of identifier names.""" + supports_server_side_cursors: bool + """indicates if the dialect supports server side cursors""" + + server_side_cursors: bool + """deprecated; indicates if the dialect should attempt to use server + side cursors by default""" + supports_sane_rowcount: bool """Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements. @@ -2302,6 +2313,11 @@ class ExecutionContext: def _setup_result_proxy(self) -> Result: raise NotImplementedError() + def fire_sequence(self, seq: Sequence_SchemaItem, type_: Integer) -> int: + """given a :class:`.Sequence`, invoke it and return the next int + value""" + raise NotImplementedError() + def create_cursor(self) -> DBAPICursor: """Return a new cursor generated from this ExecutionContext's connection. |
