logo
Browse Source

update

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

5
milvus_client.py

@ -20,7 +20,7 @@ class MilvusClient(PyOperator):
connections.connect(alias=self._connect_name, host=self._host, port=self._port) connections.connect(alias=self._connect_name, host=self._host, port=self._port)
self._collection = Collection(self._collection_name, using=self._connect_name) self._collection = Collection(self._collection_name, using=self._connect_name)
def __call__(self, *row):
def __call__(self, *data):
""" """
Insert data to Milvus. Insert data to Milvus.
@ -32,6 +32,9 @@ class MilvusClient(PyOperator):
A MutationResult object contains `insert_count` represents how many and a `primary_keys` of primary keys. A MutationResult object contains `insert_count` represents how many and a `primary_keys` of primary keys.
""" """
row = []
for item in data:
row.append([item])
mr = self._collection.insert(row) mr = self._collection.insert(row)
if mr.err_count > 0: if mr.err_count > 0:
raise RuntimeError("Insert to milvus failed") raise RuntimeError("Insert to milvus failed")

Loading…
Cancel
Save