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/relationships.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/relationships.py')
| -rw-r--r-- | lib/sqlalchemy/orm/relationships.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index dd58c0201..522947cc5 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -111,7 +111,7 @@ class RelationshipProperty(StrategizedProperty): passive_updates=True, enable_typechecks=True, active_history=False, - cascade_backrefs=True, + cascade_backrefs=False, ) _dependency_processor = None @@ -403,21 +403,11 @@ class RelationshipProperty(StrategizedProperty): :ref:`tutorial_delete_cascade` - Tutorial example describing a delete cascade. - :param cascade_backrefs=True: - A boolean value indicating if the ``save-update`` cascade should - operate along an assignment event intercepted by a backref. - When set to ``False``, the attribute managed by this relationship - will not cascade an incoming transient object into the session of a - persistent parent, if the event is received via backref. + :param cascade_backrefs=False: + Legacy; this flag is always False. - .. deprecated:: 1.4 The - :paramref:`_orm.relationship.cascade_backrefs` - flag will default to False in all cases in SQLAlchemy 2.0. - - .. seealso:: - - :ref:`backref_cascade` - Full discussion and examples on how - the :paramref:`_orm.relationship.cascade_backrefs` option is used. + .. versionchanged:: 2.0 "cascade_backrefs" functionality has been + removed. :param collection_class: A class or callable that returns a new list-holding object. will @@ -1007,7 +997,13 @@ class RelationshipProperty(StrategizedProperty): self._user_defined_foreign_keys = foreign_keys self.collection_class = collection_class self.passive_deletes = passive_deletes - self.cascade_backrefs = cascade_backrefs + + if cascade_backrefs: + raise sa_exc.ArgumentError( + "The 'cascade_backrefs' parameter passed to " + "relationship() may only be set to False." + ) + self.passive_updates = passive_updates self.remote_side = remote_side self.enable_typechecks = enable_typechecks |
