@@ -494,7 +494,7 @@ def cursor(
494494 if not self .open :
495495 raise InterfaceError (
496496 "Cannot create cursor from closed connection" ,
497- session_id_hex = self .get_session_id_hex () ,
497+ host_url = self .session . host ,
498498 )
499499
500500 cursor = Cursor (
@@ -546,7 +546,7 @@ def autocommit(self) -> bool:
546546 if not self .open :
547547 raise InterfaceError (
548548 "Cannot get autocommit on closed connection" ,
549- session_id_hex = self .get_session_id_hex () ,
549+ host_url = self .session . host ,
550550 )
551551
552552 if self ._fetch_autocommit_from_server :
@@ -578,7 +578,7 @@ def autocommit(self, value: bool) -> None:
578578 if not self .open :
579579 raise InterfaceError (
580580 "Cannot set autocommit on closed connection" ,
581- session_id_hex = self .get_session_id_hex () ,
581+ host_url = self .session . host ,
582582 )
583583
584584 # Create internal cursor for transaction control
@@ -600,7 +600,7 @@ def autocommit(self, value: bool) -> None:
600600 "operation" : "set_autocommit" ,
601601 "autocommit_value" : value ,
602602 },
603- session_id_hex = self .get_session_id_hex () ,
603+ host_url = self .session . host ,
604604 ) from e
605605 finally :
606606 if cursor :
@@ -627,7 +627,7 @@ def _fetch_autocommit_state_from_server(self) -> bool:
627627 raise TransactionError (
628628 "No result returned from SET AUTOCOMMIT query" ,
629629 context = {"operation" : "fetch_autocommit" },
630- session_id_hex = self .get_session_id_hex () ,
630+ host_url = self .session . host ,
631631 )
632632
633633 # Parse value (first column should be "true" or "false")
@@ -647,7 +647,7 @@ def _fetch_autocommit_state_from_server(self) -> bool:
647647 raise TransactionError (
648648 f"Failed to fetch autocommit state from server: { e .message } " ,
649649 context = {** e .context , "operation" : "fetch_autocommit" },
650- session_id_hex = self .get_session_id_hex () ,
650+ host_url = self .session . host ,
651651 ) from e
652652 finally :
653653 if cursor :
@@ -680,7 +680,7 @@ def commit(self) -> None:
680680 if not self .open :
681681 raise InterfaceError (
682682 "Cannot commit on closed connection" ,
683- session_id_hex = self .get_session_id_hex () ,
683+ host_url = self .session . host ,
684684 )
685685
686686 cursor = None
@@ -692,7 +692,7 @@ def commit(self) -> None:
692692 raise TransactionError (
693693 f"Failed to commit transaction: { e .message } " ,
694694 context = {** e .context , "operation" : "commit" },
695- session_id_hex = self .get_session_id_hex () ,
695+ host_url = self .session . host ,
696696 ) from e
697697 finally :
698698 if cursor :
@@ -725,13 +725,13 @@ def rollback(self) -> None:
725725 if self .ignore_transactions :
726726 raise NotSupportedError (
727727 "Transactions are not supported on Databricks" ,
728- session_id_hex = self .get_session_id_hex () ,
728+ host_url = self .session . host ,
729729 )
730730
731731 if not self .open :
732732 raise InterfaceError (
733733 "Cannot rollback on closed connection" ,
734- session_id_hex = self .get_session_id_hex () ,
734+ host_url = self .session . host ,
735735 )
736736
737737 cursor = None
@@ -743,7 +743,7 @@ def rollback(self) -> None:
743743 raise TransactionError (
744744 f"Failed to rollback transaction: { e .message } " ,
745745 context = {** e .context , "operation" : "rollback" },
746- session_id_hex = self .get_session_id_hex () ,
746+ host_url = self .session . host ,
747747 ) from e
748748 finally :
749749 if cursor :
@@ -767,7 +767,7 @@ def get_transaction_isolation(self) -> str:
767767 if not self .open :
768768 raise InterfaceError (
769769 "Cannot get transaction isolation on closed connection" ,
770- session_id_hex = self .get_session_id_hex () ,
770+ host_url = self .session . host ,
771771 )
772772
773773 return TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ
@@ -793,7 +793,7 @@ def set_transaction_isolation(self, level: str) -> None:
793793 if not self .open :
794794 raise InterfaceError (
795795 "Cannot set transaction isolation on closed connection" ,
796- session_id_hex = self .get_session_id_hex () ,
796+ host_url = self .session . host ,
797797 )
798798
799799 # Normalize and validate isolation level
@@ -805,7 +805,7 @@ def set_transaction_isolation(self, level: str) -> None:
805805 raise NotSupportedError (
806806 f"Setting transaction isolation level '{ level } ' is not supported. "
807807 f"Only { TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ } is supported." ,
808- session_id_hex = self .get_session_id_hex () ,
808+ host_url = self .session . host ,
809809 )
810810
811811
@@ -857,7 +857,7 @@ def __iter__(self):
857857 else :
858858 raise ProgrammingError (
859859 "There is no active result set" ,
860- session_id_hex = self .connection .get_session_id_hex () ,
860+ host_url = self .connection .session . host ,
861861 )
862862
863863 def _determine_parameter_approach (
@@ -997,7 +997,7 @@ def _check_not_closed(self):
997997 if not self .open :
998998 raise InterfaceError (
999999 "Attempting operation on closed cursor" ,
1000- session_id_hex = self .connection .get_session_id_hex () ,
1000+ host_url = self .connection .session . host ,
10011001 )
10021002
10031003 def _handle_staging_operation (
@@ -1041,7 +1041,7 @@ def _handle_staging_operation(
10411041 else :
10421042 raise ProgrammingError (
10431043 "You must provide at least one staging_allowed_local_path when initialising a connection to perform ingestion commands" ,
1044- session_id_hex = self .connection .get_session_id_hex () ,
1044+ host_url = self .connection .session . host ,
10451045 )
10461046
10471047 abs_staging_allowed_local_paths = [
@@ -1067,7 +1067,7 @@ def _handle_staging_operation(
10671067 if not allow_operation :
10681068 raise ProgrammingError (
10691069 "Local file operations are restricted to paths within the configured staging_allowed_local_path" ,
1070- session_id_hex = self .connection .get_session_id_hex () ,
1070+ host_url = self .connection .session . host ,
10711071 )
10721072
10731073 handler_args = {
@@ -1095,7 +1095,7 @@ def _handle_staging_operation(
10951095 raise ProgrammingError (
10961096 f"Operation { row .operation } is not supported. "
10971097 + "Supported operations are GET, PUT, and REMOVE" ,
1098- session_id_hex = self .connection .get_session_id_hex () ,
1098+ host_url = self .connection .session . host ,
10991099 )
11001100
11011101 @log_latency (StatementType .SQL )
@@ -1110,7 +1110,7 @@ def _handle_staging_put(
11101110 if local_file is None :
11111111 raise ProgrammingError (
11121112 "Cannot perform PUT without specifying a local_file" ,
1113- session_id_hex = self .connection .get_session_id_hex () ,
1113+ host_url = self .connection .session . host ,
11141114 )
11151115
11161116 with open (local_file , "rb" ) as fh :
@@ -1135,7 +1135,7 @@ def _handle_staging_http_response(self, r):
11351135 error_text = r .data .decode () if r .data else ""
11361136 raise OperationalError (
11371137 f"Staging operation over HTTP was unsuccessful: { r .status } -{ error_text } " ,
1138- session_id_hex = self .connection .get_session_id_hex () ,
1138+ host_url = self .connection .session . host ,
11391139 )
11401140
11411141 if r .status == ACCEPTED :
@@ -1166,7 +1166,7 @@ def _handle_staging_put_stream(
11661166 if not stream :
11671167 raise ProgrammingError (
11681168 "No input stream provided for streaming operation" ,
1169- session_id_hex = self .connection .get_session_id_hex () ,
1169+ host_url = self .connection .session . host ,
11701170 )
11711171
11721172 r = self .connection .http_client .request (
@@ -1187,7 +1187,7 @@ def _handle_staging_get(
11871187 if local_file is None :
11881188 raise ProgrammingError (
11891189 "Cannot perform GET without specifying a local_file" ,
1190- session_id_hex = self .connection .get_session_id_hex () ,
1190+ host_url = self .connection .session . host ,
11911191 )
11921192
11931193 r = self .connection .http_client .request (
@@ -1201,7 +1201,7 @@ def _handle_staging_get(
12011201 error_text = r .data .decode () if r .data else ""
12021202 raise OperationalError (
12031203 f"Staging operation over HTTP was unsuccessful: { r .status } -{ error_text } " ,
1204- session_id_hex = self .connection .get_session_id_hex () ,
1204+ host_url = self .connection .session . host ,
12051205 )
12061206
12071207 with open (local_file , "wb" ) as fp :
@@ -1222,7 +1222,7 @@ def _handle_staging_remove(
12221222 error_text = r .data .decode () if r .data else ""
12231223 raise OperationalError (
12241224 f"Staging operation over HTTP was unsuccessful: { r .status } -{ error_text } " ,
1225- session_id_hex = self .connection .get_session_id_hex () ,
1225+ host_url = self .connection .session . host ,
12261226 )
12271227
12281228 @log_latency (StatementType .QUERY )
@@ -1413,7 +1413,7 @@ def get_async_execution_result(self):
14131413 else :
14141414 raise OperationalError (
14151415 f"get_execution_result failed with Operation status { operation_state } " ,
1416- session_id_hex = self .connection .get_session_id_hex () ,
1416+ host_url = self .connection .session . host ,
14171417 )
14181418
14191419 def executemany (self , operation , seq_of_parameters ):
@@ -1541,7 +1541,7 @@ def fetchall(self) -> List[Row]:
15411541 else :
15421542 raise ProgrammingError (
15431543 "There is no active result set" ,
1544- session_id_hex = self .connection .get_session_id_hex () ,
1544+ host_url = self .connection .session . host ,
15451545 )
15461546
15471547 def fetchone (self ) -> Optional [Row ]:
@@ -1558,7 +1558,7 @@ def fetchone(self) -> Optional[Row]:
15581558 else :
15591559 raise ProgrammingError (
15601560 "There is no active result set" ,
1561- session_id_hex = self .connection .get_session_id_hex () ,
1561+ host_url = self .connection .session . host ,
15621562 )
15631563
15641564 def fetchmany (self , size : int ) -> List [Row ]:
@@ -1583,7 +1583,7 @@ def fetchmany(self, size: int) -> List[Row]:
15831583 else :
15841584 raise ProgrammingError (
15851585 "There is no active result set" ,
1586- session_id_hex = self .connection .get_session_id_hex () ,
1586+ host_url = self .connection .session . host ,
15871587 )
15881588
15891589 def fetchall_arrow (self ) -> "pyarrow.Table" :
@@ -1593,7 +1593,7 @@ def fetchall_arrow(self) -> "pyarrow.Table":
15931593 else :
15941594 raise ProgrammingError (
15951595 "There is no active result set" ,
1596- session_id_hex = self .connection .get_session_id_hex () ,
1596+ host_url = self .connection .session . host ,
15971597 )
15981598
15991599 def fetchmany_arrow (self , size ) -> "pyarrow.Table" :
@@ -1603,7 +1603,7 @@ def fetchmany_arrow(self, size) -> "pyarrow.Table":
16031603 else :
16041604 raise ProgrammingError (
16051605 "There is no active result set" ,
1606- session_id_hex = self .connection .get_session_id_hex () ,
1606+ host_url = self .connection .session . host ,
16071607 )
16081608
16091609 def cancel (self ) -> None :
0 commit comments