def update_entity(self, pk, pk_field):
        gae_query = self.build_query()
        entity = Get(self.ops.value_for_db(pk, pk_field))

        if not gae_query.matches_filters(entity):
            return

        for field, _, value in self.query.values:
            if hasattr(value, 'prepare_database_save'):
                value = value.prepare_database_save(field)
            else:
                value = field.get_db_prep_save(value,
                                               connection=self.connection)

            if hasattr(value, 'evaluate'):
                assert not value.negated
                assert not value.subtree_parents
                value = ExpressionEvaluator(value, self.query, entity,
                                            allow_joins=False)

            if hasattr(value, 'as_sql'):
                value = value.as_sql(lambda n: n, self.connection)

            entity[field.column] = self.ops.value_for_db(value, field)

        Put(entity)