diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-03-25 17:08:48 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-03-30 14:04:52 -0400 |
commit | 4e754a8914a1c2c16c97bdf363d2e24bfa823730 (patch) | |
tree | db723242b4e4c0d4c7f15c167857dd79fdfa6ccb /lib/sqlalchemy/sql/crud.py | |
parent | dba480ebaf89c0b5ea787661583de9da3928920f (diff) | |
download | sqlalchemy-4e754a8914a1c2c16c97bdf363d2e24bfa823730.tar.gz |
pep-484: the pep-484ening, SQL part three
hitting DML which is causing us to open up the
ColumnCollection structure a bit, as we do put anonymous
column expressions with None here. However, we still want
Table /TableClause to have named column collections that
don't return None, so parametrize the "key" in this
collection also.
* rename some "immutable" elements to "readonly". we change
the contents of immutablecolumncollection underneath, so it's
not "immutable"
Change-Id: I2593995a4e5c6eae874bed5bf76117198be8ae97
Diffstat (limited to 'lib/sqlalchemy/sql/crud.py')
-rw-r--r-- | lib/sqlalchemy/sql/crud.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index 533a2f6cd..91a3f70c9 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -39,6 +39,7 @@ from ..util.typing import Literal if TYPE_CHECKING: from .compiler import _BindNameForColProtocol from .compiler import SQLCompiler + from .dml import _DMLColumnElement from .dml import DMLState from .dml import Insert from .dml import Update @@ -129,8 +130,10 @@ def _get_crud_params( [], ) - stmt_parameter_tuples: Optional[List[Any]] - spd: Optional[MutableMapping[str, Any]] + stmt_parameter_tuples: Optional[ + List[Tuple[Union[str, ColumnClause[Any]], Any]] + ] + spd: Optional[MutableMapping[_DMLColumnElement, Any]] if compile_state._has_multi_parameters: mp = compile_state._multi_parameters @@ -355,8 +358,8 @@ def _handle_values_anonymous_param(compiler, col, value, name, **kw): def _key_getters_for_crud_column( compiler: SQLCompiler, stmt: ValuesBase, compile_state: DMLState ) -> Tuple[ - Callable[[Union[str, Column[Any]]], Union[str, Tuple[str, str]]], - Callable[[Column[Any]], Union[str, Tuple[str, str]]], + Callable[[Union[str, ColumnClause[Any]]], Union[str, Tuple[str, str]]], + Callable[[ColumnClause[Any]], Union[str, Tuple[str, str]]], _BindNameForColProtocol, ]: if dml.isupdate(compile_state) and compile_state._extra_froms: |