logo
Browse Source

update

Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
junjie.jiang 2 years ago
parent
commit
a5be2a42eb
  1. 10
      milvus_client.py

10
milvus_client.py

@ -13,9 +13,6 @@ class MilvusClient(PyOperator):
"""
def __init__(self, host: str, port: int, collection_name: str):
"""
Get an existing collection.
"""
self._host = host
self._port = port
self._collection_name = collection_name
@ -23,7 +20,7 @@ class MilvusClient(PyOperator):
connections.connect(alias=self._connect_name, host=self._host, port=self._port)
self._collection = Collection(self._collection_name, using=self._connect_name)
def __call__(self, *data):
def __call__(self, *row):
"""
Insert data to Milvus.
@ -35,10 +32,7 @@ class MilvusClient(PyOperator):
A MutationResult object contains `insert_count` represents how many and a `primary_keys` of primary keys.
"""
vectors = []
for v in data:
vectors.append(v if isinstance(v, list) else [v])
mr = self._collection.insert(vectors)
mr = self._collection.insert(row)
if mr.err_count > 0:
raise RuntimeError("Insert to milvus failed")
return None

Loading…
Cancel
Save