diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-26 16:51:32 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-27 15:55:06 -0500 |
commit | e5e5bb640abc5c98b39a6a3a955a20ef1525fc02 (patch) | |
tree | d0e6035f32930018606efe8ca75c1d285bdf834c /test/orm/inheritance/test_basic.py | |
parent | f78db5e1f68d6b2fb6a7acc04036f682d9a22974 (diff) | |
download | sqlalchemy-e5e5bb640abc5c98b39a6a3a955a20ef1525fc02.tar.gz |
Open up check for relationships that write to the same column
Enhanced logic that tracks if relationships will be conflicting with each
other when they write to the same column to include simple cases of two
relationships that should have a "backref" between them. This means that
if two relationships are not viewonly, are not linked with back_populates
and are not otherwise in an inheriting sibling/overriding arrangement, and
will populate the same foreign key column, a warning is emitted at mapper
configuration time warning that a conflict may arise. A new parameter
:paramref:`.relationship.overlaps` is added to suit those very rare cases
where such an overlapping persistence arrangement may be unavoidable.
Fixes: #5171
Change-Id: Ifae5998fc1c7e49ce059aec8a67c80cabee768ad
Diffstat (limited to 'test/orm/inheritance/test_basic.py')
-rw-r--r-- | test/orm/inheritance/test_basic.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index 831781330..9b896b59a 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -1229,7 +1229,9 @@ class EagerLazyTest(fixtures.MappedTest): foos = mapper(Foo, foo) bars = mapper(Bar, bar, inherits=foos) bars.add_property("lazy", relationship(foos, bar_foo, lazy="select")) - bars.add_property("eager", relationship(foos, bar_foo, lazy="joined")) + bars.add_property( + "eager", relationship(foos, bar_foo, lazy="joined", viewonly=True) + ) foo.insert().execute(data="foo1") bar.insert().execute(id=1, data="bar1") |