@@ -51,7 +51,7 @@ def __init__(
51
51
52
52
self .uri = uri or "http://localhost:19530/default"
53
53
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 '' } "
55
55
logger .debug ("Using USER:PASS API Key" )
56
56
57
57
self .alias = self ._create_connection (uri , api_key , timeout = timeout )
@@ -95,7 +95,7 @@ def describe_collection(
95
95
if not self .conn .has_collection (
96
96
collection_name = collection_name , using = self .alias , timeout = timeout
97
97
):
98
- raise simple_exception .CollectionDoesNotExist ()
98
+ raise simple_exception .CollectionDoesNotExist (f"Collection { collection_name } does not exist." )
99
99
res = self .conn .describe_collection (
100
100
collection_name = collection_name , timeout = timeout
101
101
)
@@ -141,7 +141,7 @@ def num_entities(self, collection_name: str, timeout: int = None) -> int:
141
141
if not self .conn .has_collection (
142
142
collection_name = collection_name , timeout = timeout
143
143
):
144
- raise simple_exception .CollectionDoesNotExist ()
144
+ raise simple_exception .CollectionDoesNotExist (f"Collection { collection_name } does not exist." )
145
145
self .conn .flush (collection_names = [collection_name ])
146
146
stats = self .conn .get_collection_stats (collection_name = collection_name )
147
147
result = {stat .key : stat .value for stat in stats }
@@ -207,7 +207,7 @@ def create_collection(
207
207
):
208
208
if overwrite is True :
209
209
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 )
211
211
else :
212
212
raise simple_exception .CollectionAlreadyExists ()
213
213
@@ -220,7 +220,7 @@ def create_collection(
220
220
if primary_type .lower () == "str" :
221
221
if primary_auto_id :
222
222
raise simple_exception .InvalidPKFormat (
223
- "str based primary_field cannot be auto-id'ed"
223
+ "Str based primary_field cannot be auto-id'ed"
224
224
)
225
225
fields .append (
226
226
FieldSchema (
@@ -338,7 +338,7 @@ def create_collection_from_schema(
338
338
):
339
339
if overwrite is True :
340
340
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 )
342
342
else :
343
343
raise simple_exception .CollectionAlreadyExists ()
344
344
@@ -404,7 +404,6 @@ def insert(
404
404
return []
405
405
406
406
if batch_size < 0 :
407
- logger .error ("Invalid batch size provided for insert." )
408
407
raise simple_exception .InvalidInsertBatchSize (
409
408
f"Invalid batch size of { batch_size } "
410
409
)
@@ -518,7 +517,6 @@ def search(
518
517
consistency_level = consistency_level ,
519
518
)
520
519
except Exception as ex :
521
- logger .error ("Failed to search collection: %s" , collection_name )
522
520
raise ex
523
521
ret = []
524
522
if include_vectors :
@@ -767,7 +765,6 @@ def _create_connection(self, uri: str, api_key: str, timeout: int = None) -> str
767
765
logger .debug ("Created new connection using: %s" , alias )
768
766
return alias
769
767
except MilvusException as ex :
770
- logger .error ("Failed to create new connection using: %s" , alias )
771
768
raise ex
772
769
773
770
def _fetch_formatter (self , field , values ):
0 commit comments