milvus-logo
LFAI
< Docs

do_bulk_insert()

This method inserts entities from files. You have to organize your data in a row-based JSON file and upload the JSON file to a MINIO or S3 bucket. For details, see Prepare a JSON file.

Invocation

do_bulk_insert(collection_name, partition_name=None, files, timeout=None, using='default', kwargs)

Parameters

ParameterDescriptionTypeRequired
collection_nameName of a colletionStringTrue
partition_nameName of a partitionStringFalse
filesList of file paths. The path must be a MINIO or S3 bucket pathList[String]True
timetoutAn optional duration of time in seconds to allow for the RPC. If it is set to None, the client keeps waiting until the server responds or error occurs.IntegerFalse
usingAlias of the Milvus connection to be attached toStringFalse

Raises

  • BaseException: Thrown if collection_name does not exist.
  • BaseException: Thrown if the list of files is invalid.

Example

from pymilvus import connections, Collection, FieldSchema, CollectionSchema, DataType, utility
connections.connect()
schema = CollectionSchema([
    FieldSchema("film_id", DataType.INT64, is_primary=True),
    FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
])
collection = Collection("test_collection_bulk_insert", schema)
task_id = utility.do_bulk_insert(collection_name=collection.name, files=['data.json'])
print(task_id)

Feedback

Was this page helpful?