The "_get_from_identity" method of "sqlalchemy.orm.query.Query" starts
like this:
@classmethod
def _get_from_identity(cls, session, key, passive):
instance = session.identity_map.get(key)
if instance:
# ...
This is problematic for me since my model class is a dict-like node
(where dict access allows reaching down to children by name). The
check "if isinstance" will therefore trigger "instance.keys()", which
is expensive. Rather than adding a "__len__" method in my code, I'd
suggest the "_get_from_identity" implementation to check for "if
instance is not None" instead:
@classmethod
def _get_from_identity(cls, session, key, passive):
instance = session.identity_map.get(key)
if instance is not None:
# ...
Thanks
Daniel
--
http://danielnouri.org
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.