logo
Browse Source

support cloud

Signed-off-by: junjiejiangjjj <junjie.jiang@zilliz.com>
main
junjiejiangjjj 2 years ago
parent
commit
ebc7eb4f43
  1. 8
      milvus_client.py

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

Loading…
Cancel
Save