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/compiler.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/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 7fd37e9b1..a2f731ac9 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -52,7 +52,6 @@ from typing import Type from typing import TYPE_CHECKING from typing import Union -from sqlalchemy.sql.ddl import DDLElement from . import base from . import coercions from . import crud @@ -79,10 +78,12 @@ from ..util.typing import Protocol from ..util.typing import TypedDict if typing.TYPE_CHECKING: + from . import roles from .annotation import _AnnotationDict from .base import _AmbiguousTableNameMap from .base import CompileState from .cache_key import CacheKey + from .ddl import DDLElement from .dml import Insert from .dml import UpdateBase from .dml import ValuesBase @@ -724,7 +725,7 @@ class SQLCompiler(Compiled): """list of columns for which onupdate default values should be evaluated before an UPDATE takes place""" - returning: Optional[List[ColumnClause[Any]]] + returning: Optional[Sequence[roles.ColumnsClauseRole]] """list of columns that will be delivered to cursor.description or dialect equivalent via the RETURNING clause on an INSERT, UPDATE, or DELETE @@ -4099,7 +4100,9 @@ class SQLCompiler(Compiled): return " FOR UPDATE" def returning_clause( - self, stmt: UpdateBase, returning_cols: List[ColumnClause[Any]] + self, + stmt: UpdateBase, + returning_cols: Sequence[roles.ColumnsClauseRole], ) -> str: raise exc.CompileError( "RETURNING is not supported by this " |