When iterating over session.Query object and calling update, I've noticed that the returned objects no longer have their __dict__'s populated.
E.g.
foos = session.query(Foo)
for foo in foos:
print "{}".format(foo.__dict__)
foo.somefield = "somevalue"
session.add(foo)
session.commit() # The next print statement won't show anything
If any of the fields in foo are read during the iteration, though, all of the __dict__ fields become resolved.
E.g.
foos = session.query(Foo)
for foo in foos:
# Reading any of the fields, causes all of the fields to be resolved.
foo.somefield
print "{}".format(foo.__dict__)
foo.somefield = "somevalue"
session.add(foo)
session.commit() # The next print statement won't show anything
Is there any way to have these values appear in __dict__ without needing to read them first?