]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Warn for settings that don't work with viewonly=True
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Nov 2019 17:15:57 +0000 (12:15 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 Nov 2019 18:12:27 +0000 (13:12 -0500)
commit22d1f0706bd6a6742ad13f0bec75b04e705ff46b
tree94fc9173cc8b4fdc064a4bd56b6ad1baa00183ea
parent3ceb87da1a66f455444e69ba25ac18ea26d8751e
Warn for settings that don't work with viewonly=True

Setting persistence-related flags on :func:`.relationship` while also
setting viewonly=True will now emit a regular warning, as these flags do
not make sense for a viewonly=True relationship.   In particular, the
"cascade" settings have their own warning that is generated based on the
individual values, such as "delete, delete-orphan", that should not apply
to a viewonly relationship.   Note however that in the case of "cascade",
these settings are still erroneously taking effect even though the
relationship is set up as "viewonly".   In 1.4, all persistence-related
cascade settings will be disallowed on a viewonly=True relationship in
order to resolve this issue.

Fixes: #4993
Change-Id: I4b607a96a7de2ffa15303a27fd93c162a681556d
doc/build/changelog/unreleased_13/4993.rst [new file with mode: 0644]
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/util.py
test/orm/test_deprecations.py