@@ -233,7 +233,6 @@ def connect_milvus(**kwargs):
233
233
and connection_details ["address" ] == kwargs ["address" ]
234
234
and connection_details ["user" ] == kwargs ["user" ]
235
235
and connection_details ["db_name" ] == kwargs ["db_name" ]
236
-
237
236
):
238
237
gh = self ._connected_alias [key ]
239
238
break
@@ -267,9 +266,8 @@ def connect_milvus(**kwargs):
267
266
password = '' if password is None else str (password )
268
267
db_name = '' if db_name is None else str (db_name )
269
268
270
- address , user , password , db_name = self .__parse_info (address , uri , host , port , db_name , user , password )
271
-
272
- if set ([address , uri , host , port ]) != {None }:
269
+ if set ([address , uri , host , port ]) != {'' }:
270
+ address , user , password , db_name = self .__parse_info (address , uri , host , port , db_name , user , password )
273
271
kwargs ["address" ] = address
274
272
275
273
elif alias in self ._alias :
@@ -362,13 +360,14 @@ def __parse_info(
362
360
db_name : str = "" ,
363
361
user : str = "" ,
364
362
password : str = "" ,
365
- ) -> dict :
363
+ ** kwargs ) -> dict :
366
364
367
365
passed_in_address = ""
368
366
passed_in_user = ""
369
367
passed_in_password = ""
370
368
passed_in_db_name = ""
371
369
370
+ # If uri
372
371
if uri != "" :
373
372
passed_in_address , passed_in_user , passed_in_password , passed_in_db_name = (
374
373
self .__parse_address_from_uri (uri )
@@ -429,11 +428,13 @@ def __parse_address_from_uri(self, uri: str) -> Tuple[str, str, str, str]:
429
428
user = parsed_uri .username if parsed_uri .username is not None else ""
430
429
password = parsed_uri .password if parsed_uri .password is not None else ""
431
430
432
- if host != "" and port != "" :
433
- self .__verify_host_port (host , port )
434
- addr = f"{ host } :{ port } "
435
- else :
436
- addr = ""
431
+ if host == "" :
432
+ raise ConnectionConfigException (message = "Illegal uri: URI is missing host address: {}" .format (uri ))
433
+ if port == "" :
434
+ raise ConnectionConfigException (message = "Illegal uri: URI is missing port: {}" .format (uri ))
435
+
436
+ self .__verify_host_port (host , port )
437
+ addr = f"{ host } :{ port } "
437
438
438
439
if not is_legal_address (addr ):
439
440
raise ConnectionConfigException (message = illegal_uri_msg .format (uri ))
0 commit comments