bkc wrote: > I load the Shipment record with get_buy, I change a string field, on > that record. I do not > reference any of the pickled values, but they still get written back. > Why? It's not possible that they're changed, I didn't even refer to > them. >
i just created another unittest to confirm this works, and it does. below is a standalone version of the test script. the binary field is only in the UPDATE statement when the pickleable value has been modified. from sqlalchemy import * e = create_engine('sqlite://', echo=True) metadata = BoundMetaData(e) table = Table('mutabletest', metadata, Column('id', Integer, primary_key=True), Column('data', PickleType), Column('value', Unicode(30))) table.create() class Bar(object): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "Bar(%d, %d)" % (self.x, self.y) class Foo(object): pass mapper(Foo, table) f1 = Foo() f1.data = Bar(4,5) f1.value = unicode('hi') session = create_session() session.save(f1) print "INITIAL SAVE" session.flush() print "\n\nUPDATE ONLY THE VALUE COLUMN" f1.value = unicode('someothervalue') session.flush() print "\n\nUPDATE BOTH DATA AND VALUE" f1.value = unicode('hi') f1.data.x = 9 session.flush() print "\n\nRELOAD" session.clear() f1 = session.get(Foo, f1.id) print "\n\nUPDATE ONLY THE VALUE COLUMN" f1.value = unicode('lala') session.flush() print "\n\nUPDATE NOTHING" session.flush() --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---