is this a mutable type like PickleType? the previous value should not be loaded otherwise (assuming at least a recent 0.5 or 0.6 version). If so, the mutability flag should be disabled.
On Nov 4, 2010, at 7:05 AM, Eoghan Murray wrote: > I have the following: > > objs = > MyTable.query.options(defer(Table.potentially_very_long_str_column)).all() > for obj in objs: > obj.potentially_very_long_str_column = '' > > At the moment, I'm seeing the assignment in the loop issue the `SELECT > potentially_very_long_str_column`, even though that column will be > overwritten. > > I pdb'd this down to orm/state.py::InstanceState.modified_event() > where the previous value is stored in self.committed_state > I'm ignorant as to what self.committed_state is used for, but maybe > rather than evaluating 'previous' value, it could be further deferred > until it is needed? This is assuming that self.committed_state will > only be used up until the session is flushed (at which time the > previous value would be lost).. > > At the moment, is there any other way of writing to a column without > first reading it using the orm? > Haven't checked, but I assume sql.expression.update doesn't have > this behaviour.. > > Cheers! > > Eoghan > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.