🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

milvus-logo
LFAI
< Docs

rename_collection()

This method renames a collection.

Invocation

rename_collection(old_collection_name, new_collection_name, timeout=None, using="default")

Parameters

ParameterDescriptionTypeRequired
old_collection_nameName of the collection before being renamedstrTrue
new_collection_nameName of the collection after being renamedstrTrue
timeoutAn optional duration of time in seconds to allow for the RPC. If it is set to None, the client will continue to wait until the server responds or any error occurs.floatFalse
usingAn alias of a connection to Milvus, and the value defaults to default.strFalse

Returns

A boolean value that indicates whether the operation succeeds.

Example

>>> from pymilvus import Collection, FieldSchema, CollectionSchema, DataType, connections, utility
>>> connections.connect(alias="default")
>>> schema = CollectionSchema(fields=[
...     FieldSchema("int64", DataType.INT64, description="int64", is_primary=True),
...     FieldSchema("float_vector", DataType.FLOAT_VECTOR, is_primary=False, dim=128),
... ])
>>> collection = Collection(name="old_collection", schema=schema)
>>> utility.rename_collection("old_collection", "new_collection")
>>> True
>>> utility.drop_collection("new_collection")
>>> utility.has_collection("new_collection")
>>> False

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?