On Dec 6, 2008, at 4:16 PM, Jorge Vargas wrote:
> So in order to make code a lot more readable I was thinking I could > use the syntax SA uses for filter and such so I can write the > _excel_to_field as > _excel_to_field = { > 'First Name' : 'Contact.first_name', > 'Last Name' : 'Contact.last_name', > 'Address' : 'Location.address', > 'City' : 'Location.city', > 'State' : 'Location.state', > 'Zip' : 'Location.zip_code', > } > please note the Location obj is a fabrication of this email > > but how can I replace the setatrr call? I guess I could parse things > around but I assume there is some kind of api in SA to accomplish > this. if I understand the problem correctly it's likely easier to place the descriptors directly in the dict, ie. {'First Name':Contact.first_name} and then use dict[fieldname].__set__(instance, value). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---