Skip to content

Commit 6e22635

Browse files
author
Filip Haltmayer
committed
changes
Signed-off-by: Filip Haltmayer <filip.haltmayer@zilliz.com>
1 parent ca569a9 commit 6e22635

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Diff for: pymilvus/simple_api/simple_api.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(
5151

5252
self.uri = uri or "http://localhost:19530/default"
5353
if api_key is None:
54-
api_key = f"{user}:{password}"
54+
api_key = f"{user if user is not None else ''}:{password if password is not None else ''}"
5555
logger.debug("Using USER:PASS API Key")
5656

5757
self.alias = self._create_connection(uri, api_key, timeout=timeout)
@@ -95,7 +95,7 @@ def describe_collection(
9595
if not self.conn.has_collection(
9696
collection_name=collection_name, using=self.alias, timeout=timeout
9797
):
98-
raise simple_exception.CollectionDoesNotExist()
98+
raise simple_exception.CollectionDoesNotExist(f"Collection {collection_name} does not exist.")
9999
res = self.conn.describe_collection(
100100
collection_name=collection_name, timeout=timeout
101101
)
@@ -141,7 +141,7 @@ def num_entities(self, collection_name: str, timeout: int = None) -> int:
141141
if not self.conn.has_collection(
142142
collection_name=collection_name, timeout=timeout
143143
):
144-
raise simple_exception.CollectionDoesNotExist()
144+
raise simple_exception.CollectionDoesNotExist(f"Collection {collection_name} does not exist.")
145145
self.conn.flush(collection_names=[collection_name])
146146
stats = self.conn.get_collection_stats(collection_name=collection_name)
147147
result = {stat.key: stat.value for stat in stats}
@@ -207,7 +207,7 @@ def create_collection(
207207
):
208208
if overwrite is True:
209209
self.conn.drop_collection(collection_name, timeout=timeout)
210-
logger.debug("Dropping collection %s", collection_name)
210+
logger.debug("Dropping collection %s due to overwrite param.", collection_name)
211211
else:
212212
raise simple_exception.CollectionAlreadyExists()
213213

@@ -220,7 +220,7 @@ def create_collection(
220220
if primary_type.lower() == "str":
221221
if primary_auto_id:
222222
raise simple_exception.InvalidPKFormat(
223-
"str based primary_field cannot be auto-id'ed"
223+
"Str based primary_field cannot be auto-id'ed"
224224
)
225225
fields.append(
226226
FieldSchema(
@@ -338,7 +338,7 @@ def create_collection_from_schema(
338338
):
339339
if overwrite is True:
340340
self.conn.drop_collection(collection_name, timeout=timeout)
341-
logger.debug("Dropping collection %s", collection_name)
341+
logger.debug("Dropping collection %s due to overwrite param.", collection_name)
342342
else:
343343
raise simple_exception.CollectionAlreadyExists()
344344

@@ -404,7 +404,6 @@ def insert(
404404
return []
405405

406406
if batch_size < 0:
407-
logger.error("Invalid batch size provided for insert.")
408407
raise simple_exception.InvalidInsertBatchSize(
409408
f"Invalid batch size of {batch_size}"
410409
)
@@ -518,7 +517,6 @@ def search(
518517
consistency_level=consistency_level,
519518
)
520519
except Exception as ex:
521-
logger.error("Failed to search collection: %s", collection_name)
522520
raise ex
523521
ret = []
524522
if include_vectors:
@@ -767,7 +765,6 @@ def _create_connection(self, uri: str, api_key: str, timeout: int = None) -> str
767765
logger.debug("Created new connection using: %s", alias)
768766
return alias
769767
except MilvusException as ex:
770-
logger.error("Failed to create new connection using: %s", alias)
771768
raise ex
772769

773770
def _fetch_formatter(self, field, values):

0 commit comments

Comments
 (0)