diff --git a/pymilvus/simple_api/simple_api.py b/pymilvus/simple_api/simple_api.py index 4493eeae3..4902f1583 100644 --- a/pymilvus/simple_api/simple_api.py +++ b/pymilvus/simple_api/simple_api.py @@ -51,7 +51,7 @@ def __init__( self.uri = uri or "http://localhost:19530/default" if api_key is None: - api_key = f"{user}:{password}" + api_key = f"{user if user is not None else ''}:{password if password is not None else ''}" logger.debug("Using USER:PASS API Key") self.alias = self._create_connection(uri, api_key, timeout=timeout) @@ -95,7 +95,7 @@ def describe_collection( if not self.conn.has_collection( collection_name=collection_name, using=self.alias, timeout=timeout ): - raise simple_exception.CollectionDoesNotExist() + raise simple_exception.CollectionDoesNotExist(f"Collection {collection_name} does not exist.") res = self.conn.describe_collection( collection_name=collection_name, timeout=timeout ) @@ -141,7 +141,7 @@ def num_entities(self, collection_name: str, timeout: int = None) -> int: if not self.conn.has_collection( collection_name=collection_name, timeout=timeout ): - raise simple_exception.CollectionDoesNotExist() + raise simple_exception.CollectionDoesNotExist(f"Collection {collection_name} does not exist.") self.conn.flush(collection_names=[collection_name]) stats = self.conn.get_collection_stats(collection_name=collection_name) result = {stat.key: stat.value for stat in stats} @@ -207,7 +207,7 @@ def create_collection( ): if overwrite is True: self.conn.drop_collection(collection_name, timeout=timeout) - logger.debug("Dropping collection %s", collection_name) + logger.debug("Dropping collection %s due to overwrite param.", collection_name) else: raise simple_exception.CollectionAlreadyExists() @@ -220,7 +220,7 @@ def create_collection( if primary_type.lower() == "str": if primary_auto_id: raise simple_exception.InvalidPKFormat( - "str based primary_field cannot be auto-id'ed" + "Str based primary_field cannot be auto-id'ed" ) fields.append( FieldSchema( @@ -338,7 +338,7 @@ def create_collection_from_schema( ): if overwrite is True: self.conn.drop_collection(collection_name, timeout=timeout) - logger.debug("Dropping collection %s", collection_name) + logger.debug("Dropping collection %s due to overwrite param.", collection_name) else: raise simple_exception.CollectionAlreadyExists() @@ -404,7 +404,6 @@ def insert( return [] if batch_size < 0: - logger.error("Invalid batch size provided for insert.") raise simple_exception.InvalidInsertBatchSize( f"Invalid batch size of {batch_size}" ) @@ -518,7 +517,6 @@ def search( consistency_level=consistency_level, ) except Exception as ex: - logger.error("Failed to search collection: %s", collection_name) raise ex ret = [] if include_vectors: @@ -767,7 +765,6 @@ def _create_connection(self, uri: str, api_key: str, timeout: int = None) -> str logger.debug("Created new connection using: %s", alias) return alias except MilvusException as ex: - logger.error("Failed to create new connection using: %s", alias) raise ex def _fetch_formatter(self, field, values):