diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-07-18 10:58:24 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-07-18 10:58:24 -0400 |
commit | 5e8c7c88de2d9bac58e82bc1e5af7fcad5405855 (patch) | |
tree | 87094ca0ac2b087a7e54133ac2babfcfb994fbb7 /lib/sqlalchemy/testing/entities.py | |
parent | c01f90de584f50f036c5b6d0c44074b4b3014da4 (diff) | |
download | sqlalchemy-5e8c7c88de2d9bac58e82bc1e5af7fcad5405855.tar.gz |
Fixes for uselist=True with m2o relationships
Fixed bug where a many-to-one relationship that specified ``uselist=True``
would fail to update correctly during a primary key change where a related
column needs to change.
Fixed bug where the detection for many-to-one or one-to-one use with a
"dynamic" relationship, which is an invalid configuration, would fail to
raise if the relationship were configured with ``uselist=True``. The
current fix is that it warns, instead of raises, as this would otherwise be
backwards incompatible, however in a future release it will be a raise.
Fixes: #4772
Change-Id: Ibd5d2f7329ff245c88118e2533fc8ef42a09fef3
Diffstat (limited to 'lib/sqlalchemy/testing/entities.py')
-rw-r--r-- | lib/sqlalchemy/testing/entities.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/entities.py b/lib/sqlalchemy/testing/entities.py index b894979d0..cbc7a2fd5 100644 --- a/lib/sqlalchemy/testing/entities.py +++ b/lib/sqlalchemy/testing/entities.py @@ -7,7 +7,7 @@ import sqlalchemy as sa from .. import exc as sa_exc - +from ..util import compat _repr_stack = set() @@ -90,7 +90,9 @@ class ComparableEntity(BasicEntity): except (AttributeError, sa_exc.UnboundExecutionError): return False - if hasattr(value, "__iter__"): + if hasattr(value, "__iter__") and not isinstance( + value, compat.string_types + ): if hasattr(value, "__getitem__") and not hasattr( value, "keys" ): |