diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-09-27 17:32:10 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-09-30 10:10:58 -0400 |
commit | 6ddb62a8ba66b19afd41b967911ce5982250856e (patch) | |
tree | b98eba226618f2dff301366ac7e384f052feb69e /lib/sqlalchemy/orm/util.py | |
parent | 2c34d2503a17316cae3282192405b9b9d60df6fe (diff) | |
download | sqlalchemy-6ddb62a8ba66b19afd41b967911ce5982250856e.tar.gz |
Simplify _ColumnEntity, related
In the interests of making Query much more lightweight up front,
rework the calculations done at the top when the entities
are constructed to be much less inolved. Use the new
coercion system for _ColumnEntity and stop accepting
plain strings, this will need to emit a deprecation warning
in 1.3.x. Use annotations and other techniques to reduce
the decisionmaking and complexity of Query.
For the use case of subquery(), .statement, etc. we would like
to do minimal work in order to get the columns clause.
Change-Id: I7e459bbd3bb10ec71235f75ef4f3b0a969bec590
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r-- | lib/sqlalchemy/orm/util.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 4b4fa4052..747ec7e65 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -668,10 +668,11 @@ class AliasedInsp(InspectionAttr): state["represents_outer_join"], ) - def _adapt_element(self, elem): - return self._adapter.traverse(elem)._annotate( - {"parententity": self, "parentmapper": self.mapper} - ) + def _adapt_element(self, elem, key=None): + d = {"parententity": self, "parentmapper": self.mapper} + if key: + d["orm_key"] = key + return self._adapter.traverse(elem)._annotate(d) def _entity_for_mapper(self, mapper): self_poly = self.with_polymorphic_mappers |