Could we add this new method on sqlalchemy.orm.Session?

def get_local(self, class_, ident, entity_name=None):
    """Get an object from the identity map (do not hit the database)

    Returns None if the object does not exist in this session's
identity map.
    """
    idkey = self.mapper(class_,
entity_name=entity_name).identity_key(ident)
    return self.identity_map.get(idkey)

This is handy for doing tasks such as expiring/expunging/etc. an
instance but only if it exists in the session. I'm not sure if it
makes sense to have the entity_name parameter because I've never used
it before, but I added it just in case.

Thanks,
~ Daniel


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to