[sqlalchemy] How to determine many-to-many relations using object_mapper().iterate_properties?

2011-04-20 Thread Mahmoud Abdelkader
I'm having a bit of trouble with this snippet from another stackoverflow question: http://stackoverflow.com/questions/1623661/sqlalchemy-shallow-copy-avoiding-lazy-loading The snippet in question: from sqlalchemy.orm import object_mapper, ColumnProperty, RelationProperty newobj =

Re: [sqlalchemy] How to determine many-to-many relations using object_mapper().iterate_properties?

2011-04-20 Thread Michael Bayer
On Apr 20, 2011, at 5:09 PM, Mahmoud Abdelkader wrote: for model_property in object_mapper(user).iterate_properties: if isinstance(model_property, ColumnProperty): key = model_property.key dictionary[key] = getattr(user, key) elif (isinstance(model_property,