From ebc7eb4f43c4d1fb45f1d051ce6140fa70c80936 Mon Sep 17 00:00:00 2001 From: junjiejiangjjj Date: Fri, 3 Feb 2023 17:54:33 +0800 Subject: [PATCH] support cloud Signed-off-by: junjiejiangjjj --- milvus_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/milvus_client.py b/milvus_client.py index 9a0d394..f57b015 100644 --- a/milvus_client.py +++ b/milvus_client.py @@ -12,12 +12,16 @@ class MilvusClient(PyOperator): Milvus ANN index class. """ - def __init__(self, host: str, port: int, collection_name: str): + def __init__(self, host: str, port: int, collection_name: str, user: str = None, password: str = None): self._host = host self._port = port self._collection_name = collection_name self._connect_name = uuid.uuid4().hex - connections.connect(alias=self._connect_name, host=self._host, port=self._port) + if None in [user, password]: + connections.connect(alias=self._connect_name, host=self._host, port=self._port) + else: + connections.connect(alias=self._connect_name, host=self._host, port=self._port, + user=user, password=password, secure=True) self._collection = Collection(self._collection_name, using=self._connect_name) def __call__(self, *data):