Hello All,
I have a session object, for instance:
my_object = session.query(Person).filter_by(name='MYSELF').first()
I know I can access to its attributes to modify the database:
my_object.name = 'YOURSELF'
my_object.town = 'PARIS'
Is there a way to access its attributes on another way ?
The point is that I have a dictionary that records all values of
several textcontrols (with wxPython):
my_dict = {'name':'YOURSELF', 'town':'PARIS'} etc
I would like to link (with a loop) the keys of this dictionary with
the attributes of the session object, without having to
write again all the attributes (my_object.name = my_dict['name'] etc )
since there are a lot.
I tried to loop like this without success:
for (key,value) in my_dict.iteritems():
my_object.key = value # my_object[key] = value doesn't
work either
Thanks in advance for any hints and sorry for the low level of my
question !
Dominique
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---