I'm creating a general routine that is intended to take an arbitrary dict of attribute / value pairs and an ORM object instance, and use the dict to update the properties of the ORM instance, without knowing a priori whether the attributes might be relations to other tables. The problem I ran in to is when a property that is a relation needs to be created anew, because then I don't know what class to create an instance of. From looking at the source, I found what I was looking for under the argument attribute of the PropertyLoader class, so I am currently doing along the lines of:
attr_class = object_mapper(ormvar).properties[attr].argument new_instance = attr_class() setattr(ormvar, attr, new_instance) However, this feels like it might be a bit fragile, as the argument attribute isn't explicitly document that I could find. Is there an API / documented way of determining the class that represents a particular attribute, as determined by mapper() or relation()? Hope this makes sense. Thanks. - Cory Johns CONFIDENTIAL NOTICE: This email including any attachments, contains confidential information belonging to the sender. It may also be privileged or otherwise protected by work product immunity or other legal rules. This information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this emailed information is strictly prohibited. If you have received this email in error, please immediately notify us by reply email of the error and then delete this email immediately. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---