diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-11 12:51:46 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-11 12:51:46 -0500 |
| commit | 4376c2e5b016e8dfec7bc1b0d2ebbebae737c063 (patch) | |
| tree | d16bca4088fada1399e354adc37bef6f0e64d9fd /lib/sqlalchemy/dialects/mysql/mysqlconnector.py | |
| parent | 532ddb0fa717bc10c3a95b7ddf3a60bbfad7ac56 (diff) | |
| download | sqlalchemy-4376c2e5b016e8dfec7bc1b0d2ebbebae737c063.tar.gz | |
Begin to disallow back_populates with viewonly=True
A viewonly=True relationship should not be mutated and ideally
mutation itself would raise an error, but we're not there yet.
Warn when a viewonly is to be the target of a back_populates
as this only means that it should be locally mutated, which
by definition will not work as expected because post-flush
it will deliver doubled results, due to its state not being
reset.
Setting a relationship to viewonly=True which is also the target of a
back_populates or backref configuration will now emit a warning and
eventually be disallowed. back_populates refers specifically to mutation
of an attribute or collection, which is disallowed when the attribute is
subject to viewonly=True. The viewonly attribute is not subject to
persistence behaviors which means it will not reflect correct results
when it is locally mutated.
Fixes: #5149
Change-Id: Ie51382a82e1a0ff5f3cf2cdbded780e77ace7f5f
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/mysqlconnector.py')
0 files changed, 0 insertions, 0 deletions
