diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-12-10 16:21:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-12-10 16:21:09 +0000 |
| commit | 2d777e16074c365db64f62cbca150e7fbd46df71 (patch) | |
| tree | e7ba6449c9119b8b5b6e57ac28ff6ee24320fed5 /lib/sqlalchemy/orm/query.py | |
| parent | 9d837b02b5eb42385281b88d09fe2aeea0376ca9 (diff) | |
| parent | 9e20d410212296517f8dffd2531d55fee196635b (diff) | |
| download | sqlalchemy-2d777e16074c365db64f62cbca150e7fbd46df71.tar.gz | |
Merge "Removals: strings for join(), loader_options()." into main
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index bd80749d2..a2e247f14 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -2186,25 +2186,6 @@ class Query( in the 1.4 series for the following features: - * Joining on relationship names rather than attributes:: - - session.query(User).join("addresses") - - **Why it's legacy**: the string name does not provide enough context - for :meth:`_query.Query.join` to always know what is desired, - notably in that there is no indication of what the left side - of the join should be. This gives rise to flags like - ``from_joinpoint`` as well as the ability to place several - join clauses in a single :meth:`_query.Query.join` call - which don't solve the problem fully while also - adding new calling styles that are unnecessary and expensive to - accommodate internally. - - **Modern calling pattern**: Use the actual relationship, - e.g. ``User.addresses`` in the above case:: - - session.query(User).join(User.addresses) - * Automatic aliasing with the ``aliased=True`` flag:: session.query(Node).join(Node.children, aliased=True).\ @@ -2337,7 +2318,6 @@ class Query( onclause, ( elements.ColumnElement, - str, interfaces.PropComparator, types.FunctionType, ), @@ -2361,7 +2341,7 @@ class Query( # this checks for an extremely ancient calling form of # reversed tuples. - if isinstance(prop[0], (str, interfaces.PropComparator)): + if isinstance(prop[0], interfaces.PropComparator): prop = (prop[1], prop[0]) _props.append(prop) @@ -2400,11 +2380,7 @@ class Query( legacy=True, apply_propagate_attrs=self, ), - ( - coercions.expect(roles.OnClauseRole, prop[1], legacy=True) - # if not isinstance(prop[1], str) - # else prop[1] - ) + (coercions.expect(roles.OnClauseRole, prop[1], legacy=True)) if len(prop) == 2 else None, None, |
