async def update(self, obj, only=None):
field_dict = dict(obj.__data__)<EOL>pk_field = obj._meta.primary_key<EOL>if only:<EOL><INDENT>self._prune_fields(field_dict, only)<EOL><DEDENT>if obj._meta.only_save_dirty:<EOL><INDENT>self._prune_fields(field_dict, obj.dirty_fields)<EOL><DEDENT>if obj._meta.composite_key:<EOL><INDENT>for pk_part_name in pk_field.field_names:<EOL><INDENT>field_dict.pop(pk_part_name, None)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>field_dict.pop(pk_field.name, None)<EOL><DEDENT>query = obj.update(**field_dict).where(obj._pk_expr())<EOL>result = await self.execute(query)<EOL>obj._dirty.clear()<EOL>return result<EOL>
Update the object in the database. Optionally, update only
        the specified fields. For creating a new object use :meth:`.create()`

        :param only: (optional) the list/tuple of fields or
                     field names to update