From 4e754a8914a1c2c16c97bdf363d2e24bfa823730 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 25 Mar 2022 17:08:48 -0400 Subject: 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 --- lib/sqlalchemy/sql/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/util.py') diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 5114a2431..cdce49f7b 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -15,6 +15,7 @@ from itertools import chain import typing from typing import Any from typing import cast +from typing import Iterator from typing import Optional from . import coercions @@ -33,6 +34,7 @@ from .elements import _find_columns # noqa from .elements import _label_reference from .elements import _textual_label_reference from .elements import BindParameter +from .elements import ClauseElement # noqa from .elements import ColumnClause from .elements import ColumnElement from .elements import Grouping @@ -51,6 +53,7 @@ from .. import exc from .. import util if typing.TYPE_CHECKING: + from .roles import FromClauseRole from ..engine.interfaces import _AnyExecuteParams from ..engine.interfaces import _AnyMultiExecuteParams from ..engine.interfaces import _AnySingleExecuteParams @@ -404,7 +407,7 @@ def clause_is_present(clause, search): return False -def tables_from_leftmost(clause): +def tables_from_leftmost(clause: FromClauseRole) -> Iterator[FromClause]: if isinstance(clause, Join): for t in tables_from_leftmost(clause.left): yield t -- cgit v1.2.1