4949from mssql_python .constants import ConstantsDDBC , GetInfoConstants
5050from mssql_python .connection_string_parser import _ConnectionStringParser
5151from mssql_python .connection_string_builder import _ConnectionStringBuilder
52- from mssql_python .constants import _RESERVED_PARAMETERS
52+ from mssql_python .constants import _RESERVED_PARAMETERS , _KEY_AUTHENTICATION , _KEY_UID
5353
5454if TYPE_CHECKING :
5555 from mssql_python .row import Row
@@ -292,7 +292,7 @@ def __init__(
292292 raise ValueError ("native_uuid must be a boolean value or None" )
293293 self ._native_uuid = native_uuid
294294
295- self .connection_str , self . _parsed_params = self ._construct_connection_string (
295+ self .connection_str , parsed_params = self ._construct_connection_string (
296296 connection_str , ** kwargs
297297 )
298298 self ._attrs_before = attrs_before or {}
@@ -337,20 +337,20 @@ def __init__(
337337
338338 # Handle Entra ID authentication if specified.
339339 # The parsed dict is used directly — no re-parsing of the connection string.
340- if "Authentication" in self . _parsed_params :
341- auth_type = process_auth_parameters (self . _parsed_params )
340+ if _KEY_AUTHENTICATION in parsed_params :
341+ auth_type = process_auth_parameters (parsed_params )
342342
343343 if auth_type :
344344 # Capture credential kwargs (e.g. user-assigned MSI client_id)
345345 # from the parsed dict *before* remove_sensitive_params strips UID.
346346 credential_kwargs : Optional [Dict [str , str ]] = None
347347 if auth_type == "msi" :
348- uid = (self . _parsed_params . get ("UID" ) or "" ).strip ()
348+ uid = (parsed_params . get (_KEY_UID ) or "" ).strip ()
349349 if uid :
350350 credential_kwargs = {"client_id" : uid }
351351
352352 # Strip sensitive params and rebuild the connection string.
353- sanitized = remove_sensitive_params (self . _parsed_params )
353+ sanitized = remove_sensitive_params (parsed_params )
354354 self .connection_str = _ConnectionStringBuilder (sanitized ).build ()
355355 token = get_auth_token (auth_type , credential_kwargs )
356356 if token :
@@ -360,7 +360,7 @@ def __init__(
360360 # Store auth type so bulkcopy() can acquire a fresh token later.
361361 # On Windows Interactive, process_auth_parameters returns None
362362 # (DDBC handles auth natively), so fall back to extract_auth_type.
363- self ._auth_type = auth_type or extract_auth_type (self . _parsed_params )
363+ self ._auth_type = auth_type or extract_auth_type (parsed_params )
364364
365365 self ._closed = False
366366 self ._timeout = timeout
0 commit comments