Browse Source
update
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
1 changed files with
6 additions and
3 deletions
-
milvus_client.py
|
|
@ -22,7 +22,7 @@ class MilvusClient(PyOperator): |
|
|
|
|
|
|
|
def __call__(self, *data): |
|
|
|
""" |
|
|
|
Insert data to Milvus. |
|
|
|
Insert one row to Milvus. |
|
|
|
|
|
|
|
Args: |
|
|
|
data (`list`): |
|
|
@ -34,7 +34,10 @@ class MilvusClient(PyOperator): |
|
|
|
""" |
|
|
|
row = [] |
|
|
|
for item in data: |
|
|
|
row.append([item]) |
|
|
|
if isinstance(item, list): |
|
|
|
row.extend([[i] for i in item]) |
|
|
|
else: |
|
|
|
row.append([item]) |
|
|
|
mr = self._collection.insert(row) |
|
|
|
if mr.err_count > 0: |
|
|
|
raise RuntimeError("Insert to milvus failed") |
|
|
@ -42,7 +45,7 @@ class MilvusClient(PyOperator): |
|
|
|
|
|
|
|
@property |
|
|
|
def shared_type(self): |
|
|
|
return SharedType.Shareable |
|
|
|
return SharedType.Shareable |
|
|
|
|
|
|
|
def __del__(self): |
|
|
|
if connections.has_connection(self._connect_name): |
|
|
|