drop_collection()
This operation drops a collection.
This method applies only to dedicated serving clusters and on-demand compute.
For a managed collection in serving clusters, please create MilvusClient with the cluster endpoint.
Free & Serverless
https://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com
- Dedicated
https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530
- For an external collection for on-demand compute, create MilvusClient with the project endpoints.
https://{project-id}.{region}.api.zillizcloud.com
Request syntax
drop_collection(
collection_name: str,
timeout: Optional[float] = None,
**kwargs,
) -> None
PARAMETERS:
-
collection_name (str) -
[REQUIRED]
The name of an existing collection.
-
timeout (Optional[float]) -
The timeout duration for this operation. Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
RETURN TYPE:
NoneType
RETURNS:
None
EXCEPTIONS:
-
MilvusException
This exception will be raised when any error occurs during this operation.
Examples
from pymilvus import MilvusClient
client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN"
)
# Create a collection
client.create_collection(
collection_name="test_collection",
dimension=5
)
# List collections
res = client.list_collections()
# ['test_collection']
# Drop the collection
client.drop_collection(collection_name="test_collection")
# Verify
res = client.list_collections()
# []