fine, but the name "get_local" is not so descriptive and also attracts
the focus away from the existing "identity_map" accessor.  how about
we jack up the "identity_map" dictionary to be smarter ?  so you could
say:

session.identity_map.find(class_, ident, entity_name='foo')



On Mar 8, 10:07 am, "Daniel" <[EMAIL PROTECTED]> wrote:
> 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 sqlalchemy@googlegroups.com
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