From ef7ff058eb67d73ebeac7b125ab2a7806e14629c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 13 Jun 2019 12:37:22 -0400 Subject: SelectBase no longer a FromClause As part of the SQLAlchemy 2.0 migration project, a conceptual change has been made to the role of the :class:`.SelectBase` class hierarchy, which is the root of all "SELECT" statement constructs, in that they no longer serve directly as FROM clauses, that is, they no longer subclass :class:`.FromClause`. For end users, the change mostly means that any placement of a :func:`.select` construct in the FROM clause of another :func:`.select` requires first that it be wrapped in a subquery first, which historically is through the use of the :meth:`.SelectBase.alias` method, and is now also available through the use of :meth:`.SelectBase.subquery`. This was usually a requirement in any case since several databases don't accept unnamed SELECT subqueries in their FROM clause in any case. See the documentation in this change for lots more detail. Fixes: #4617 Change-Id: I0f6174ee24b9a1a4529168e52e855e12abd60667 --- lib/sqlalchemy/sql/expression.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index b04355cf5..7ce822669 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -16,6 +16,7 @@ class. __all__ = [ "Alias", + "AliasedReturnsRows", "any_", "all_", "ClauseElement", @@ -76,6 +77,7 @@ __all__ = [ "union_all", "update", "within_group", + "Subquery", "TableSample", "tablesample", ] @@ -132,6 +134,7 @@ from .functions import Function # noqa from .functions import FunctionElement # noqa from .functions import modifier # noqa from .selectable import Alias # noqa +from .selectable import AliasedReturnsRows # noqa from .selectable import CompoundSelect # noqa from .selectable import CTE # noqa from .selectable import Exists # noqa @@ -148,10 +151,12 @@ from .selectable import ScalarSelect # noqa from .selectable import Select # noqa from .selectable import Selectable # noqa from .selectable import SelectBase # noqa +from .selectable import Subquery # noqa from .selectable import subquery # noqa from .selectable import TableClause # noqa from .selectable import TableSample # noqa from .selectable import TextAsFrom # noqa +from .selectable import TextualSelect # noqa from .visitors import Visitable # noqa from ..util.langhelpers import public_factory # noqa -- cgit v1.2.1