diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-04-07 12:37:23 -0400 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2022-04-12 02:09:50 +0000 |
commit | aa9cd878e8249a4a758c7f968e929e92fede42a5 (patch) | |
tree | 1be1c9dc24dd247a150be55d65bfc56ebaf111bc /lib/sqlalchemy/orm/context.py | |
parent | 98eae4e181cb2d1bbc67ec834bfad29dcba7f461 (diff) | |
download | sqlalchemy-aa9cd878e8249a4a758c7f968e929e92fede42a5.tar.gz |
pep-484: session, instancestate, etc
Also adds some fixes to annotation-based mapping
that have come up, as well as starts to add more
pep-484 test cases
Change-Id: Ia722bbbc7967a11b23b66c8084eb61df9d233fee
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index edd3fb56b..419da65f7 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -9,6 +9,7 @@ from __future__ import annotations import itertools from typing import Any +from typing import cast from typing import Dict from typing import List from typing import Optional @@ -61,7 +62,7 @@ from ..sql.selectable import SelectState from ..sql.visitors import InternalTraversal if TYPE_CHECKING: - from ._typing import _EntityType + from ._typing import _InternalEntityType from ..sql.compiler import _CompilerStackEntry from ..sql.dml import _DMLTableElement from ..sql.elements import ColumnElement @@ -213,7 +214,7 @@ class ORMCompileState(CompileState): statement: Union[Select, FromStatement] select_statement: Union[Select, FromStatement] _entities: List[_QueryEntity] - _polymorphic_adapters: Dict[_EntityType, ORMAdapter] + _polymorphic_adapters: Dict[_InternalEntityType, ORMAdapter] compile_options: Union[ Type[default_compile_options], default_compile_options ] @@ -630,6 +631,24 @@ class FromStatement(GroupedElement, ReturnsRows, Executable): return compiler.process(compile_state.statement, **kw) + @property + def column_descriptions(self): + """Return a :term:`plugin-enabled` 'column descriptions' structure + referring to the columns which are SELECTed by this statement. + + See the section :ref:`queryguide_inspection` for an overview + of this feature. + + .. seealso:: + + :ref:`queryguide_inspection` - ORM background + + """ + meth = cast( + ORMSelectCompileState, SelectState.get_plugin_class(self) + ).get_column_descriptions + return meth(self) + def _ensure_disambiguated_names(self): return self |