milvus-logo

Check Partition Information

This topic describes how to check the information of the partition in Milvus.

Verify if a partition exists

Verify if a partition exists in the specified collection.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.has_partition("novel")
await milvusClient.partitionManager.hasPartition({
  collection_name: "book",
  partition_name: "novel",
});
hasPar, err := milvusClient.HasPartition(
  context.Background(),   // ctx
  "book",                 // CollectionName
  "novel",                // partitionName
)
if err != nil {
  log.Fatal("failed to check the partition:", err.Error())
}
log.Println(hasPar)
R<Boolean> respHasPartition = milvusClient.hasPartition(
  HasPartitionParam.newBuilder()
    .withCollectionName("book")
    .withPartitionName("novel")
    .build()
);
if (respHasPartition.getData() == Boolean.TRUE) {
  System.out.println("Partition exists.");
}
describe partition -c book -p novel
Parameter Description
partition_name Name of the partition to check.
Parameter Description
collection_name Name of the collection to check.
partition_name Name of the partition to check.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to check.
partitionName Name of the partition to check.
Option Description
-c Name of the collection to check.
-p Name of the partition to check.

List all partitions

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.partitions
await milvusClient.partitionManager.showPartitions({
  collection_name: "book",
});
listPar, err := milvusClient.ShowPartitions(
  context.Background(),   // ctx
  "book",                 // CollectionName
)
if err != nil {
  log.Fatal("failed to list partitions:", err.Error())
}
log.Println(listPar)
R<ShowPartitionsResponse> respShowPartitions = milvusClient.showPartitions(
  ShowPartitionsParam.newBuilder()
          .withCollectionName("book")
          .build()
);
System.out.println(respShowPartitions);
list partitions -c book
Parameter Description
collection_name Name of the collection to check.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to check.
Parameter Description
CollectionName Name of the collection to check.
Option Description
-c Name of the collection to check.

What's next

On this page