@@ -354,7 +354,7 @@ def _build_client_context(self, server_hostname: str, **kwargs):
354354 """Build ClientContext for HTTP client configuration."""
355355 from databricks .sql .auth .common import ClientContext
356356 from databricks .sql .types import SSLOptions
357-
357+
358358 # Extract SSL options
359359 ssl_options = SSLOptions (
360360 tls_verify = not kwargs .get ("_tls_no_verify" , False ),
@@ -364,22 +364,26 @@ def _build_client_context(self, server_hostname: str, **kwargs):
364364 tls_client_cert_key_file = kwargs .get ("_tls_client_cert_key_file" ),
365365 tls_client_cert_key_password = kwargs .get ("_tls_client_cert_key_password" ),
366366 )
367-
367+
368368 # Build user agent
369369 user_agent_entry = kwargs .get ("user_agent_entry" , "" )
370370 if user_agent_entry :
371371 user_agent = f"PyDatabricksSqlConnector/{ __version__ } ({ user_agent_entry } )"
372372 else :
373373 user_agent = f"PyDatabricksSqlConnector/{ __version__ } "
374-
374+
375375 return ClientContext (
376376 hostname = server_hostname ,
377377 ssl_options = ssl_options ,
378378 socket_timeout = kwargs .get ("_socket_timeout" ),
379- retry_stop_after_attempts_count = kwargs .get ("_retry_stop_after_attempts_count" , 30 ),
379+ retry_stop_after_attempts_count = kwargs .get (
380+ "_retry_stop_after_attempts_count" , 30
381+ ),
380382 retry_delay_min = kwargs .get ("_retry_delay_min" , 1.0 ),
381383 retry_delay_max = kwargs .get ("_retry_delay_max" , 60.0 ),
382- retry_stop_after_attempts_duration = kwargs .get ("_retry_stop_after_attempts_duration" , 900.0 ),
384+ retry_stop_after_attempts_duration = kwargs .get (
385+ "_retry_stop_after_attempts_duration" , 900.0
386+ ),
383387 retry_delay_default = kwargs .get ("_retry_delay_default" , 1.0 ),
384388 retry_dangerous_codes = kwargs .get ("_retry_dangerous_codes" , []),
385389 http_proxy = kwargs .get ("_http_proxy" ),
@@ -443,7 +447,7 @@ def get_protocol_version(openSessionResp: TOpenSessionResp):
443447 @property
444448 def open (self ) -> bool :
445449 """Return whether the connection is open by checking if the session is open."""
446- return hasattr (self , ' session' ) and self .session .is_open
450+ return hasattr (self , " session" ) and self .session .is_open
447451
448452 def cursor (
449453 self ,
@@ -792,10 +796,12 @@ def _handle_staging_put(
792796 )
793797
794798 with open (local_file , "rb" ) as fh :
795- r = self .connection .session .http_client .request ('PUT' , presigned_url , body = fh .read (), headers = headers )
799+ r = self .connection .session .http_client .request (
800+ "PUT" , presigned_url , body = fh .read (), headers = headers
801+ )
796802 # Add compatibility attributes for urllib3 response
797803 r .status_code = r .status
798- if hasattr (r , ' data' ):
804+ if hasattr (r , " data" ):
799805 r .content = r .data
800806 r .ok = r .status < 400
801807 r .text = r .data .decode () if r .data else ""
@@ -835,10 +841,12 @@ def _handle_staging_get(
835841 session_id_hex = self .connection .get_session_id_hex (),
836842 )
837843
838- r = self .connection .session .http_client .request ('GET' , presigned_url , headers = headers )
844+ r = self .connection .session .http_client .request (
845+ "GET" , presigned_url , headers = headers
846+ )
839847 # Add compatibility attributes for urllib3 response
840848 r .status_code = r .status
841- if hasattr (r , ' data' ):
849+ if hasattr (r , " data" ):
842850 r .content = r .data
843851 r .ok = r .status < 400
844852 r .text = r .data .decode () if r .data else ""
@@ -860,10 +868,12 @@ def _handle_staging_remove(
860868 ):
861869 """Make an HTTP DELETE request to the presigned_url"""
862870
863- r = self .connection .session .http_client .request ('DELETE' , presigned_url , headers = headers )
871+ r = self .connection .session .http_client .request (
872+ "DELETE" , presigned_url , headers = headers
873+ )
864874 # Add compatibility attributes for urllib3 response
865875 r .status_code = r .status
866- if hasattr (r , ' data' ):
876+ if hasattr (r , " data" ):
867877 r .content = r .data
868878 r .ok = r .status < 400
869879 r .text = r .data .decode () if r .data else ""
0 commit comments