]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Establish future behavior for Session cascade backrefs, bind
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Aug 2020 19:05:53 +0000 (15:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Aug 2020 23:41:04 +0000 (19:41 -0400)
commit14fdd6260a578488bdad95b738ea6af5c2fcd13c
tree4801e916ea7e2008857dae0be86898d8adadfd1c
parent3d5a64ac09b55514da6fd30f0f085348c2d10496
Establish future behavior for Session cascade backrefs, bind

The behavior of the :paramref:`_orm.relationship.cascade_backrefs` flag
will be reversed in 2.0 and set to ``False`` unconditionally, such that
backrefs don't cascade save-update operations from a forwards-assignment to
a backwards assignment.   A 2.0 deprecation warning is emitted when the
parameter is left at its default of ``True`` at the point at which such a
cascade operation actually takes place.   The new behavior can be
established as always by setting the flag to ``False`` on a specific
:func:`_orm.relationship`, or more generally can be set up across the board
by setting the the :paramref:`_orm.Session.future` flag to True.

Additionally in the interests of expediency, this commit will also
move Session away from making use of bound metadata if the future=True
flag is set.   An application that sets future=True should ideally
have to change as little else as possible for full 2.0 behavior.

Fixes: #5150
Change-Id: I490d1d61f09c62ffc2de983208aeed25dfe48aec
19 files changed:
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/5150.rst [new file with mode: 0644]
doc/build/errors.rst
doc/build/orm/cascades.rst
lib/sqlalchemy/orm/dependency.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/unitofwork.py
lib/sqlalchemy/testing/fixtures.py
test/orm/inheritance/test_polymorphic_rel.py
test/orm/test_cache_key.py
test/orm/test_cascade.py
test/orm/test_composites.py
test/orm/test_froms.py
test/orm/test_lambdas.py
test/orm/test_query.py
test/orm/test_transaction.py
test/orm/test_update_delete.py