Skip to main content

load()

This operation loads the data of the current partition into memory.

📘Notes

Using the partition_names parameter in the load() method of a Collection object is equivalent to using the load() method of corresponding Partition objects.

Request Syntax​

load(
replica_number: int,
timeout: float | None
)

PARAMETERS:

  • replica_number (int)

    The number of replicas to load in the current partition. The default value is 1, indicating that one replica in the current partition is loaded.

  • 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:

NoneType

RETURNS:

None

EXCEPTIONS:

  • MilvusException

    This arises when any error occurs during this operation.

Examples​

from pymilvus import Collection, Partition, CollectionSchema, FieldSchema, DataType

schema = CollectionSchema([
FieldSchema("id", DataType.INT64, is_primary=True),
FieldSchema("vector", DataType.FLOAT_VECTOR, dim=5)
])

# Create a collection
collection = Collection(
name="test_collection",
schema=schema
)

# Create a partition
partition = Partition(
collection=collection,
name="test_partition"
)

# Load a partition with one replica of the collection data
partition.load()

# Load a partition with two replicas of the collection data
partition.load(
replica_number=2
)

The following operations are related to load():