Hello everyone. I have a class that uses a "custom" column to store a list of strings. The column is saved in the database using a comma sepparated string. When it's loaded into an instance, it "becomes" a list:
class Keyword(declarativeBase): __tablename__ = "keywords" _id = Column("id", Integer, primary_key=True) _values = column_property(Column("values", CharSeparatedStrings.CharSeparatedStrings()), extension=ValuesAttributeExtension.ValuesAttributeExtension(), active_history=True) I want to use an extension to check the items that have been deleted/modified in that list. That's why I'm wrapping the Column in a column_property. When I put a bunch of checkpoints in the "ValueAttributeExtension", the value that is going to be set is always an empty list. The oldvalue works fine, though: class ValuesAttributeExtension(AttributeExtension): def append(self, state, value, initiator): print("%s::append > Checkpoint!. Value: %s, state.obj()::%s" % (self.__class__.__name__, value, state.obj())) return value def remove(self, state, value, initiator): print("%s::append > Checkpoint!. Value: %s, state.obj()::%s" % (self.__class__.__name__, value, state.obj())) return value def set(self, state, value, oldValue, initiator): print("%s::set > Checkpoint!. Value: %s, oldValue: %s, state.obj().values: %s" % (self.__class__.__name__, value, oldValue, state.obj().values)) return value Let's say the initial (old) value was ["yes"] and I add a "no". I would expect the "value" parameter in the set method to be ["yes", "no"] and the oldValue to be ["yes"] but this is what I get: ValuesAttributeExtension::set > Checkpoint!. Value: [], oldValue: [u'yes'], state.obj().values: [u'yes'] The "append" or "remove" methods are never run... I guess that's because it's a weird type (not really a relationship) so that's ok, but I'd like to know if there's a way of getting the new value that is going to be set, to check the differences. Everything else seems to be working fine, though. Even though value is an empty list in the "set" method, it gets properly updated in the database. Thank you in advance. -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.