On Tuesday 11 December 2007 13:13:37 King Simon-NFHD78 wrote: > Hi, > > I used to be able to iterate over mapper.properties.items() to get > the name of each mapped property along with the object that > implements it. However, in 0.4.1, trying to do this results in a > NotImplementedError telling me to use iterate_properties and > get_property instead, but I can't see a way to get the name of the > property through either of these methods. > > Is there a generic way that, given a mapped class, I can get a list > of the mapped properties with their names? iterate_props yields Property instances; maybe p.key is the name u want. here a generic wrapper simulating dict.items(): def props_iter( mapr, klas =sqlalchemy.orm.PropertyLoader ): try: i = mapr.properties except: # about r3740 for p in mapr.iterate_properties: if isinstance( p, klas): yield p.key, p else: for k,p in i.iteritems(): yield k,p
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---