> -----Original Message----- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Andreas Jung > Sent: 19 December 2008 06:30 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: Efficient dictificationof result sets > > On 19.12.2008 2:57 Uhr, Michael Bayer wrote: > > > > On Dec 18, 2008, at 3:04 PM, Andreas Jung wrote: > >> Does SA contain some official API to introspect the list of defined > >> synonyms for a particular class? The goal is to take values defined > >> as a > >> synonym also into account for the dictification (for backward > >> compatiblity reasons for an existing codebase). > > > > the mapper's get_property() method includes a "resolve_synonyms" > > keyword arg that indicates a given key which points to a synonym > > should return the actual referenced property, so a recipe > that builds > > upon this would look like: > > > > set([mapper.get_property(p.key, resolve_synonyms=True) for p in > > mapper.iterate_properties]) > > However this does not apply when using the declarative layer. Any > options within such a context? > > Andreas >
I haven't been following this discussion closely, so I'm probably wrong, but that statement doesn't sound right to me. As far as I'm aware, the declarative layer is just a convenience for setting up Tables and mapped classes at the same time. The end result is exactly the same as if you created the tables and classes in the traditional way. I would be very surprised if the above expression didn't work. You can get the mapper for a mapped class or object using the "class_mapper" and "object_mapper" functions. Hope that helps, Simon --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---