def update(self):
        self.pre_update and self.pre_update()
        kw = {}
        for k, v in self.__mappings__.iteritems():
            if v.updatable:
                if hasattr(self, k):
                    arg = getattr(self, k)
                else:
                    arg = v.default
                    setattr(self, k, arg)
                kw[k] = arg
        pk = self.__primary_key__.name
        update_kw(self.__table__, '%s=?' % pk, getattr(self, pk), **kw)
        return self
dataset/ETHPy150Open michaelliao/transwarp/transwarp/db.py/Model.update/original