milvus-logo
LFAI
< Docs
  • Python

insert()

This method inserts data into a specified partition.

Invocation

insert(data, timeout=None, **kwargs)

Parameters

ParameterDescriptionTypeRequired
dataData to insertlist-like(list, tuple)True
timeoutAn 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.FloatFalse

Return

A MutationResult object.

Properties

PropertyDescriptionType
insert_countNumber of the inserted entitiesInteger
primary_keysList of the primary keys of the inserted entitieslist[String]

Raises

PartitionNotExistException: error if the partition does not exist.

Example

import random
data = [
  [i for i in range(2000)],
  [i for i in range(10000, 12000)],
  [[random.random() for _ in range(2)] for _ in range(2000)],
]
from pymilvus import Partition
partition = Partition("book", "novel", "")
partition.insert(data)

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?