summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/coercions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-12-08 14:19:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-12-08 19:32:44 -0500
commit9e20d410212296517f8dffd2531d55fee196635b (patch)
treec6c9123d70dc7c6580321517889933fb0159fff3 /lib/sqlalchemy/sql/coercions.py
parent356c5268e0e90cd6d212e75e7cd3206c2aa4c4a3 (diff)
downloadsqlalchemy-9e20d410212296517f8dffd2531d55fee196635b.tar.gz
Removals: strings for join(), loader_options().
* The :meth:`_orm.Query.join` method no longer accepts strings for relationship names; the long-documented approach of using ``Class.attrname`` for join targets is now standard. * Loader options no longer accept strings for attribute names. The long-documented approach of using ``Class.attrname`` for loader option targets is now standard. It is hoped that a subsequent commit can refactor loader options to no longer need "UnboundLoad" for most cases. Change-Id: If4629882c40523dccbf4459256bf540fb468b618 References: #6986
Diffstat (limited to 'lib/sqlalchemy/sql/coercions.py')
-rw-r--r--lib/sqlalchemy/sql/coercions.py27
1 files changed, 2 insertions, 25 deletions
diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py
index 07da49c4e..38eed4d2a 100644
--- a/lib/sqlalchemy/sql/coercions.py
+++ b/lib/sqlalchemy/sql/coercions.py
@@ -610,20 +610,6 @@ class OnClauseImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl):
_coerce_consts = True
- def _implicit_coercions(
- self, original_element, resolved, argname=None, legacy=False, **kw
- ):
- if legacy and isinstance(resolved, str):
- return resolved
- else:
- return super(OnClauseImpl, self)._implicit_coercions(
- original_element,
- resolved,
- argname=argname,
- legacy=legacy,
- **kw
- )
-
def _text_coercion(self, element, argname=None, legacy=False):
if legacy and isinstance(element, str):
util.warn_deprecated_20(
@@ -925,9 +911,8 @@ class JoinTargetImpl(RoleImpl):
_skip_clauseelement_for_target_match = True
- def _literal_coercion(self, element, legacy=False, **kw):
- if isinstance(element, str):
- return element
+ def _literal_coercion(self, element, argname=None, **kw):
+ self._raise_for_expected(element, argname)
def _implicit_coercions(
self, original_element, resolved, argname=None, legacy=False, **kw
@@ -937,14 +922,6 @@ class JoinTargetImpl(RoleImpl):
# #6550, unless JoinTargetImpl._skip_clauseelement_for_target_match
# were set to False.
return original_element
- elif legacy and isinstance(resolved, str):
- util.warn_deprecated_20(
- "Using strings to indicate relationship names in "
- "Query.join() is deprecated and will be removed in "
- "SQLAlchemy 2.0. Please use the class-bound attribute "
- "directly."
- )
- return resolved
elif legacy and isinstance(resolved, roles.WhereHavingRole):
return resolved
elif legacy and resolved._is_select_statement: