Hi, Chris. Have you checked http://docs.sqlalchemy.org/en/latest/orm/extensions/mutable.html ?
Regards, Tate -----Original Message----- From: Chris Withers <ch...@simplistix.co.uk> Sender: sqlalchemy@googlegroups.com Date: Fri, 24 Feb 2012 10:49:46 To: <sqlalchemy@googlegroups.com> Reply-To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] How can I tell SA that a mutable attribute has changed? Hi All, I have a JSON field that's value is usually a dictionary: class MyModel(Base): config = Column(JSONType(255)) (Does SA have a JSONType now? we're using a homebrew one, that may be where the problem lies...) So, if I do: obj = session.query(MyModel).one() obj.config['foo'] += 1 session.commit() ...on my dev machine, the change gets persisted. Of course, on production machines, it does not :-( The change I seem to need is: config = dict(obj.config) config['foo'] += 1 obj.config = config Is there a better way? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- 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. -- 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.