From a5be2a42ebcb4d0e29d36360102917783a4c09bc Mon Sep 17 00:00:00 2001 From: "junjie.jiang" Date: Thu, 15 Dec 2022 17:11:58 +0800 Subject: [PATCH] update Signed-off-by: junjie.jiang --- milvus_client.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/milvus_client.py b/milvus_client.py index e2c81dc..e8dec0b 100644 --- a/milvus_client.py +++ b/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