diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-07-09 18:24:12 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-07-09 18:24:12 -0400 |
| commit | f34f634824da18a71f3c898a2e19e19e5f26bede (patch) | |
| tree | 43c07ea44f5e05c2b17f139258c9cd135ff4a38d /lib/sqlalchemy/orm | |
| parent | 941143858ba949c3a4a2dfcc5cd710ae6d4146e1 (diff) | |
| download | sqlalchemy-f34f634824da18a71f3c898a2e19e19e5f26bede.tar.gz | |
Expire memoizations on setattr/delattr, check in delattr
Fixed bug where declarative would not update the state of the
:class:`.Mapper` as far as what attributes were present, when additional
attributes were added or removed after the mapper attribute collections had
already been called and memoized. Addtionally, a ``NotImplementedError``
is now raised if a fully mapped attribute (e.g. column, relationship, etc.)
is deleted from a class that is currently mapped, since the mapper will not
function correctly if the attribute has been removed.
Change-Id: Idaca8e0237b31aa1d6564d94c3a179d7dc6b5df9
Fixes: #4133
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index a30a8c243..e856c6c79 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -86,6 +86,7 @@ class Mapper(InspectionAttr): """ _new_mappers = False + _dispose_called = False def __init__(self, class_, @@ -1274,6 +1275,7 @@ class Mapper(InspectionAttr): def dispose(self): # Disable any attribute-based compilation. self.configured = True + self._dispose_called = True if hasattr(self, '_configure_failed'): del self._configure_failed |
