upload_file_to_volume()
This operation uploads the local file at the specified source path to the target file path within the specified managed volume.
This applies only to managed volumes. External volumes are read-only.
Request Syntax
upload_file_to_volume(
source_file_path: str,
target_volume_path: str,
upload_concurrency: int = 5,
max_retries: int = 5,
retry_interval: float = 5.0,
progress_callback: Callable[[UploadProgress], None] | None = None,
part_size: int = 0,
) -> dict
PARAMETERS:
-
source_file_path (str) -
[REQUIRED]
The local file or directory path to upload. -
target_volume_path (str) -
[REQUIRED]
The destination path in the Zilliz Cloud volume. -
upload_concurrency (int) -
Default:5
The maximum number of files to upload concurrently. -
max_retries (int) -
Default:5
The maximum number of upload attempts for each file. -
retry_interval (float) -
Default:5.0
The delay, in seconds, between upload attempts. -
progress_callback (Callable[[UploadProgress], None] | None) -
Default:None
The callback invoked with upload progress snapshots. -
part_size (int) -
Default:0
The multipart upload part size, in bytes. Use0to select the size automatically.
RETURN TYPE:
dict
RETURNS:
Dictionary containing volumeName, volume_name, and the uploaded target path.
EXCEPTIONS:
- MilvusException
Raised when the server rejects the request or the RPC fails. Inspect the server error message for exact failure details.
Examples
The example demonstrates upload file to volume usage.
from pymilvus.bulk_writer import VolumeFileManager, VolumeManager
manager = VolumeManager(cloud_endpoint="https://api.cloud.zilliz.com", api_key="YOUR_API_KEY")
manager.create_volume(project_id="proj-xxxx", region_id="aws-us-west-2", volume_name="book-volume", volume_type="EXTERNAL")
manager.describe_volume("book-volume")
manager.list_volumes(project_id="proj-xxxx", volume_type="EXTERNAL")
file_manager = VolumeFileManager(cloud_endpoint="https://api.cloud.zilliz.com", api_key="YOUR_API_KEY", volume_name="book-volume")
file_manager.upload_file_to_volume(source_file_path="./data/books.parquet", target_volume_path="datasets/books/books.parquet", upload_concurrency=4)