milvus-logo

delete()

This method deletes entities from a specified collection.

Invocation

delete(expr, partition_name=None, timeout=None, **kwargs)

Parameters

ParameterDescriptionTypeRequired
exprBoolean expression that specifies the primary keys of the entities to deleteStringTrue
partition_nameName of the partition to delete data fromStringFalse
timeoutAn optional duration of time in seconds to allow for the RPC. If it is set to None, the client keeps waiting until the server responds or error occurs.FloatFalse

Return

A MutationResult object.

Properties

PropertyDescriptionType
delete_countNumber of the entities to deleteInteger

Raises

  • RpcError: error if gRPC encounter an error.
  • ParamError: error if the parameters are invalid.
  • BaseException: error if the return result from server is not ok.

Example

expr = "book_id in [0,1]"
from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.delete(expr)