summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/attributes.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r--lib/sqlalchemy/orm/attributes.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index 2dbef2497..c6c1860ea 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -883,6 +883,19 @@ class InstanceState(object):
or (key in self.manager.mutable_attributes and not self.manager[key].impl.check_mutable_modified(self))
])
unmodified = property(unmodified)
+
+ def unloaded(self):
+ """a set of keys which do not have a loaded value.
+
+ This includes expired attributes and any other attribute that
+ was never populated or modified.
+
+ """
+ return util.Set([
+ key for key in self.manager.keys() if
+ key not in self.committed_state and key not in self.dict
+ ])
+ unloaded = property(unloaded)
def expire_attributes(self, attribute_names):
self.expired_attributes = util.Set(self.expired_attributes)