2
2
from typing import Dict , Tuple , List , Optional , Any , Union
3
3
4
4
from databricks .sql .thrift_api .TCLIService import ttypes
5
+ from databricks .sql .ids import SessionId , CommandId
5
6
from databricks .sql .utils import ExecuteResponse
6
7
from databricks .sql .types import SSLOptions
7
8
@@ -14,19 +15,19 @@ def open_session(
14
15
session_configuration : Optional [Dict [str , Any ]],
15
16
catalog : Optional [str ],
16
17
schema : Optional [str ],
17
- ) -> ttypes . TOpenSessionResp :
18
+ ) -> SessionId :
18
19
pass
19
20
20
21
@abstractmethod
21
- def close_session (self , session_handle : ttypes . TSessionHandle ) -> None :
22
+ def close_session (self , session_id : SessionId ) -> None :
22
23
pass
23
24
24
25
# == Query Execution, Command Management ==
25
26
@abstractmethod
26
27
def execute_command (
27
28
self ,
28
29
operation : str ,
29
- session_handle : ttypes . TSessionHandle ,
30
+ session_id : SessionId ,
30
31
max_rows : int ,
31
32
max_bytes : int ,
32
33
lz4_compression : bool ,
@@ -39,25 +40,21 @@ def execute_command(
39
40
pass
40
41
41
42
@abstractmethod
42
- def cancel_command (self , operation_handle : ttypes . TOperationHandle ) -> None :
43
+ def cancel_command (self , command_id : CommandId ) -> None :
43
44
pass
44
45
45
46
@abstractmethod
46
- def close_command (
47
- self , operation_handle : ttypes .TOperationHandle
48
- ) -> ttypes .TStatus :
47
+ def close_command (self , command_id : CommandId ) -> ttypes .TStatus :
49
48
pass
50
49
51
50
@abstractmethod
52
- def get_query_state (
53
- self , operation_handle : ttypes .TOperationHandle
54
- ) -> ttypes .TOperationState :
51
+ def get_query_state (self , command_id : CommandId ) -> ttypes .TOperationState :
55
52
pass
56
53
57
54
@abstractmethod
58
55
def get_execution_result (
59
56
self ,
60
- operation_handle : ttypes . TOperationHandle ,
57
+ command_id : CommandId ,
61
58
cursor : Any ,
62
59
) -> ExecuteResponse :
63
60
pass
@@ -66,7 +63,7 @@ def get_execution_result(
66
63
@abstractmethod
67
64
def get_catalogs (
68
65
self ,
69
- session_handle : ttypes . TSessionHandle ,
66
+ session_id : SessionId ,
70
67
max_rows : int ,
71
68
max_bytes : int ,
72
69
cursor : Any ,
@@ -76,7 +73,7 @@ def get_catalogs(
76
73
@abstractmethod
77
74
def get_schemas (
78
75
self ,
79
- session_handle : ttypes . TSessionHandle ,
76
+ session_id : SessionId ,
80
77
max_rows : int ,
81
78
max_bytes : int ,
82
79
cursor : Any ,
@@ -88,7 +85,7 @@ def get_schemas(
88
85
@abstractmethod
89
86
def get_tables (
90
87
self ,
91
- session_handle : ttypes . TSessionHandle ,
88
+ session_id : SessionId ,
92
89
max_rows : int ,
93
90
max_bytes : int ,
94
91
cursor : Any ,
@@ -102,7 +99,7 @@ def get_tables(
102
99
@abstractmethod
103
100
def get_columns (
104
101
self ,
105
- session_handle : ttypes . TSessionHandle ,
102
+ session_id : SessionId ,
106
103
max_rows : int ,
107
104
max_bytes : int ,
108
105
cursor : Any ,
@@ -115,11 +112,11 @@ def get_columns(
115
112
116
113
# == Utility Methods ==
117
114
@abstractmethod
118
- def handle_to_id (self , handle : ttypes . TSessionHandle ) -> bytes :
115
+ def handle_to_id (self , session_id : SessionId ) -> Any :
119
116
pass
120
117
121
118
@abstractmethod
122
- def handle_to_hex_id (self , handle : ttypes . TSessionHandle ) -> str :
119
+ def handle_to_hex_id (self , session_id : SessionId ) -> str :
123
120
pass
124
121
125
122
# Properties related to specific backend features
0 commit comments