truncate_collection()

Deprecated.

This API is an ORM-style PyMilvus API and will be removed in PyMilvus 3.1. Use MilvusClient instead.

This operation truncates a collection by name.

Request Syntax

truncate_collection(
    collection_name: str,
    timeout: float | None,
    using: str
)

PARAMETERS:

  • collection_name (str) -

    [REQUIRED]

    Name of the collection to be truncated.

  • using (string) -

    Alias of the connection. Defaults to default.

  • timeout (float | None)

    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:

None

RETURNS:

None

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation.

Example

from pymilvus import connections, utility

conn = connections.connect(
    host="127.0.0.1", 
    port=19530
)

utility.truncate_collection(collection_name="test_collection")

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?