We have a model with a JSON field where user flags get inserted. Inserting does work as expected, but when removing certain flags, they stay in the field and changes don't get persisted to the DB.
我们的模型中有以下方法:
def del_flag(self, key):
if self.user_flags is None or not key in self.user_flags:
return False
else:
del self.user_flags[key]
db.session.commit()
return True
数据库是Postgres,我们使用SQLalChemy JSON字段方言作为字段类型.对此有什么建议吗?