diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-03 13:49:26 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-05 19:28:49 -0500 |
commit | 01c50c64e302c193733cef7fb146fbab8eaa44bd (patch) | |
tree | dca946206da557a14a681768d094b92c95dfabe4 /lib/sqlalchemy/orm/unitofwork.py | |
parent | 146a349d81023805264f81643db50a5281da90da (diff) | |
download | sqlalchemy-01c50c64e302c193733cef7fb146fbab8eaa44bd.tar.gz |
Remove all remaining removed_in_20 warnings slated for removal
Finalize all remaining removed-in-2.0 changes so that we
can begin doing pep-484 typing without old things
getting in the way (we will also have to do public_factory).
note there are a few "moved_in_20()" and "became_legacy_in_20()"
warnings still in place. The SQLALCHEMY_WARN_20 variable
is now removed.
Also removed here are the legacy "in place mutators" for Select
statements, and some keyword-only argument signatures in Core
have been added.
Also in the big change department, the ORM mapper() function
is removed entirely; the Mapper class is otherwise unchanged,
just the public-facing API function. Mappers are now always
given a registry in which to participate, however the
argument signature of Mapper is not changed. ideally "registry"
would be the first positional argument.
Fixes: #7257
Change-Id: Ic70c57b9f1cf7eb996338af5183b11bdeb3e1623
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 03456e572..6f85508f3 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -21,18 +21,6 @@ from .. import util from ..util import topological -def _warn_for_cascade_backrefs(state, prop): - util.warn_deprecated_20( - '"%s" object is being merged into a Session along the backref ' - 'cascade path for relationship "%s"; in SQLAlchemy 2.0, this ' - "reverse cascade will not take place. Set cascade_backrefs to " - "False in either the relationship() or backref() function for " - "the 2.0 behavior; or to set globally for the whole " - "Session, set the future=True flag" % (state.class_.__name__, prop), - code="s9r1", - ) - - def track_cascade_events(descriptor, prop): """Establish event listeners on object attributes which handle cascade-on-set/append. @@ -57,14 +45,9 @@ def track_cascade_events(descriptor, prop): if ( prop._cascade.save_update - and ( - (prop.cascade_backrefs and not sess.future) - or key == initiator.key - ) + and (key == initiator.key) and not sess._contains_state(item_state) ): - if key != initiator.key: - _warn_for_cascade_backrefs(item_state, prop) sess._save_or_update_state(item_state) return item @@ -119,14 +102,9 @@ def track_cascade_events(descriptor, prop): newvalue_state = attributes.instance_state(newvalue) if ( prop._cascade.save_update - and ( - (prop.cascade_backrefs and not sess.future) - or key == initiator.key - ) + and (key == initiator.key) and not sess._contains_state(newvalue_state) ): - if key != initiator.key: - _warn_for_cascade_backrefs(newvalue_state, prop) sess._save_or_update_state(newvalue_state) if ( |