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):