From eb9d00c4b4f4f15e871aa9ea88d41023054c6e97 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 9 Jan 2023 08:53:57 -0500 Subject: accept TableClause through mapped selectable chain type annotation somehow decided that TableClause doesn't have primary key fields which is not the case at all. In particular the "views" recipe relies on TableClause so adding a restriction like this does not make any sense. It seems the issue was to open this up for typing, by allowing TableClause out as far as ddl.sort_tables() typing is passing for now. Support it out in get_bind() etc. Fixes: #9071 Change-Id: If0e22e0e7df7bee0ff4b295b0ffacfbc6b7a0142 --- lib/sqlalchemy/sql/ddl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/ddl.py b/lib/sqlalchemy/sql/ddl.py index 9a5b00244..5ea500a32 100644 --- a/lib/sqlalchemy/sql/ddl.py +++ b/lib/sqlalchemy/sql/ddl.py @@ -42,6 +42,7 @@ if typing.TYPE_CHECKING: from .schema import SchemaItem from .schema import Sequence from .schema import Table + from .selectable import TableClause from ..engine.base import Connection from ..engine.interfaces import CacheStats from ..engine.interfaces import CompiledCacheType @@ -1179,9 +1180,11 @@ class SchemaDropper(InvokeDropDDLBase): def sort_tables( - tables: Iterable[Table], + tables: Iterable[TableClause], skip_fn: Optional[Callable[[ForeignKeyConstraint], bool]] = None, - extra_dependencies: Optional[typing_Sequence[Tuple[Table, Table]]] = None, + extra_dependencies: Optional[ + typing_Sequence[Tuple[TableClause, TableClause]] + ] = None, ) -> List[Table]: """Sort a collection of :class:`_schema.Table` objects based on dependency. -- cgit v1.2.1