|
3 | 3 |
|
4 | 4 | Implementations of this class are responsible for: |
5 | 5 | - Managing connections to Databricks SQL services |
6 | | -- Handling authentication |
7 | 6 | - Executing SQL queries and commands |
8 | 7 | - Retrieving query results |
9 | 8 | - Fetching metadata about catalogs, schemas, tables, and columns |
10 | | -- Managing error handling and retries |
11 | 9 | """ |
12 | 10 |
|
13 | 11 | from abc import ABC, abstractmethod |
@@ -110,11 +108,44 @@ def cancel_command(self, command_id: CommandId) -> None: |
110 | 108 | pass |
111 | 109 |
|
112 | 110 | @abstractmethod |
113 | | - def close_command(self, command_id: CommandId) -> None: |
| 111 | + def close_command(self, command_id: CommandId) -> ttypes.TStatus: |
| 112 | + """ |
| 113 | + Closes a command and releases associated resources. |
| 114 | +
|
| 115 | + This method informs the server that the client is done with the command |
| 116 | + and any resources associated with it can be released. |
| 117 | +
|
| 118 | + Args: |
| 119 | + command_id: The command identifier to close |
| 120 | +
|
| 121 | + Returns: |
| 122 | + ttypes.TStatus: The status of the close operation |
| 123 | +
|
| 124 | + Raises: |
| 125 | + ValueError: If the command ID is invalid |
| 126 | + OperationalError: If there's an error closing the command |
| 127 | + """ |
114 | 128 | pass |
115 | 129 |
|
116 | 130 | @abstractmethod |
117 | | - def get_query_state(self, command_id: CommandId) -> CommandState: |
| 131 | + def get_query_state(self, command_id: CommandId) -> ttypes.TOperationState: |
| 132 | + """ |
| 133 | + Gets the current state of a query or command. |
| 134 | +
|
| 135 | + This method retrieves the current execution state of a command from the server. |
| 136 | +
|
| 137 | + Args: |
| 138 | + command_id: The command identifier to check |
| 139 | +
|
| 140 | + Returns: |
| 141 | + ttypes.TOperationState: The current state of the command |
| 142 | +
|
| 143 | + Raises: |
| 144 | + ValueError: If the command ID is invalid |
| 145 | + OperationalError: If there's an error retrieving the state |
| 146 | + ServerOperationError: If the command is in an error state |
| 147 | + DatabaseError: If the command has been closed unexpectedly |
| 148 | + """ |
118 | 149 | pass |
119 | 150 |
|
120 | 151 | @abstractmethod |
@@ -173,30 +204,29 @@ def get_columns( |
173 | 204 | schema_name: Optional[str] = None, |
174 | 205 | table_name: Optional[str] = None, |
175 | 206 | column_name: Optional[str] = None, |
176 | | - ) -> "ResultSet": |
177 | | - pass |
178 | | - |
179 | | - # == Properties == |
180 | | - @property |
181 | | - @abstractmethod |
182 | | - def staging_allowed_local_path(self) -> Union[None, str, List[str]]: |
| 207 | + ) -> ExecuteResponse: |
183 | 208 | """ |
184 | | - Gets the allowed local paths for staging operations. |
| 209 | + Retrieves a list of columns, optionally filtered by catalog, schema, table, and column name patterns. |
185 | 210 |
|
186 | | - Returns: |
187 | | - Union[None, str, List[str]]: The allowed local paths for staging operations, |
188 | | - or None if staging is not allowed |
189 | | - """ |
190 | | - pass |
| 211 | + This method fetches metadata about columns available in the specified table, |
| 212 | + or all tables if not specified. |
191 | 213 |
|
192 | | - @property |
193 | | - @abstractmethod |
194 | | - def ssl_options(self) -> SSLOptions: |
195 | | - """ |
196 | | - Gets the SSL options for this client. |
| 214 | + Args: |
| 215 | + session_id: The session identifier |
| 216 | + max_rows: Maximum number of rows to fetch in a single batch |
| 217 | + max_bytes: Maximum number of bytes to fetch in a single batch |
| 218 | + cursor: The cursor object that will handle the results |
| 219 | + catalog_name: Optional catalog name pattern to filter by |
| 220 | + schema_name: Optional schema name pattern to filter by |
| 221 | + table_name: Optional table name pattern to filter by |
| 222 | + column_name: Optional column name pattern to filter by |
197 | 223 |
|
198 | 224 | Returns: |
199 | | - SSLOptions: The SSL configuration options |
| 225 | + ExecuteResponse: An object containing the column metadata |
| 226 | +
|
| 227 | + Raises: |
| 228 | + ValueError: If the session ID is invalid |
| 229 | + OperationalError: If there's an error retrieving the columns |
200 | 230 | """ |
201 | 231 | pass |
202 | 232 |
|
|
0 commit comments