On Jul 9, 2008, at 12:10 PM, Luis Bruno wrote:

>
> Michael Bayer escreveu:
>> in 0.5, the attributes on classes vs. the columns on Tables are very
>> different beasts now.
>
> Got bitten by this too; I'm using MappedClass.c.keys() to serialize  
> all
> attributes of a class but don't want to write out every field name.
>
> Should I use self._sa_class_manager.keys() instead?
>
> items = dict()
> for field in self._sa_class_manager.keys():
>     items[field] = getattr(self, field)
>
> Is there a simpler way, perhaps?
>

obj.__dict__ is available as always for reading, I'd think thats the  
easiest way to get at current object state.

items = dict([(k, v] for k, v in self.__dict__.iteritems() if not  
k.startswith('_')])



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