On Fri, 5 Dec 2008, King Simon-NFHD78 wrote:

> You can get the mapper for a given instance using the
> sqlalchemy.orm.object_mapper function, and that mapper has a
> 'primary_key_from_instance' method. A generic primary_key function might
> look like this (untested):
>
> import sqlalchemy.orm as orm
>
> def get_primary_key(instance):
>   mapper = orm.object_mapper(instance)
>   return mapper.primary_key_from_instance(instance)
>
> Hope that helps,

Hi Simon,

Thanks, that is very helpful. That's exactly what I need.

                                          Regards, Faheem.

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