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/context.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/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 4a3d5286b..8e3dc3134 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -1457,7 +1457,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState): # legacy ^^^^^^^^^^^^^^^^^^^^^^^^^^^ if ( - isinstance(right, (interfaces.PropComparator, str)) + isinstance(right, interfaces.PropComparator) and onclause is None ): onclause = right @@ -1478,11 +1478,9 @@ class ORMSelectCompileState(ORMCompileState, SelectState): of_type = None if isinstance(onclause, str): - # string given, e.g. query(Foo).join("bar"). - # we look to the left entity or what we last joined - # towards - onclause = _entity_namespace_key( - inspect(self._joinpoint_zero()), onclause + raise sa_exc.ArgumentError( + "ORM mapped attributes as join targets must be " + "stated the attribute itself, not string name" ) # legacy vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv @@ -1495,7 +1493,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState): # to work with the aliased=True flag, which is also something # that probably shouldn't exist on join() due to its high # complexity/usefulness ratio - elif from_joinpoint and isinstance( + if from_joinpoint and isinstance( onclause, interfaces.PropComparator ): jp0 = self._joinpoint_zero() |