33
44Implementations of this class are responsible for:
55- Managing connections to Databricks SQL services
6- - Handling authentication
76- Executing SQL queries and commands
87- Retrieving query results
98- Fetching metadata about catalogs, schemas, tables, and columns
10- - Managing error handling and retries
119"""
1210
1311from abc import ABC , abstractmethod
@@ -111,10 +109,40 @@ def cancel_command(self, command_id: CommandId) -> None:
111109
112110 @abstractmethod
113111 def close_command (self , command_id : CommandId ) -> None :
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+ Raises:
122+ ValueError: If the command ID is invalid
123+ OperationalError: If there's an error closing the command
124+ """
114125 pass
115126
116127 @abstractmethod
117128 def get_query_state (self , command_id : CommandId ) -> CommandState :
129+ """
130+ Gets the current state of a query or command.
131+
132+ This method retrieves the current execution state of a command from the server.
133+
134+ Args:
135+ command_id: The command identifier to check
136+
137+ Returns:
138+ CommandState: The current state of the command
139+
140+ Raises:
141+ ValueError: If the command ID is invalid
142+ OperationalError: If there's an error retrieving the state
143+ ServerOperationError: If the command is in an error state
144+ DatabaseError: If the command has been closed unexpectedly
145+ """
118146 pass
119147
120148 @abstractmethod
@@ -123,6 +151,23 @@ def get_execution_result(
123151 command_id : CommandId ,
124152 cursor : "Cursor" ,
125153 ) -> "ResultSet" :
154+ """
155+ Retrieves the results of a previously executed command.
156+
157+ This method fetches the results of a command that was executed asynchronously
158+ or retrieves additional results from a command that has more rows available.
159+
160+ Args:
161+ command_id: The command identifier for which to retrieve results
162+ cursor: The cursor object that will handle the results
163+
164+ Returns:
165+ ResultSet: An object containing the query results and metadata
166+
167+ Raises:
168+ ValueError: If the command ID is invalid
169+ OperationalError: If there's an error retrieving the results
170+ """
126171 pass
127172
128173 # == Metadata Operations ==
@@ -134,6 +179,25 @@ def get_catalogs(
134179 max_bytes : int ,
135180 cursor : "Cursor" ,
136181 ) -> "ResultSet" :
182+ """
183+ Retrieves a list of available catalogs.
184+
185+ This method fetches metadata about all catalogs available in the current
186+ session's context.
187+
188+ Args:
189+ session_id: The session identifier
190+ max_rows: Maximum number of rows to fetch in a single batch
191+ max_bytes: Maximum number of bytes to fetch in a single batch
192+ cursor: The cursor object that will handle the results
193+
194+ Returns:
195+ ResultSet: An object containing the catalog metadata
196+
197+ Raises:
198+ ValueError: If the session ID is invalid
199+ OperationalError: If there's an error retrieving the catalogs
200+ """
137201 pass
138202
139203 @abstractmethod
@@ -146,6 +210,27 @@ def get_schemas(
146210 catalog_name : Optional [str ] = None ,
147211 schema_name : Optional [str ] = None ,
148212 ) -> "ResultSet" :
213+ """
214+ Retrieves a list of schemas, optionally filtered by catalog and schema name patterns.
215+
216+ This method fetches metadata about schemas available in the specified catalog
217+ or all catalogs if no catalog is specified.
218+
219+ Args:
220+ session_id: The session identifier
221+ max_rows: Maximum number of rows to fetch in a single batch
222+ max_bytes: Maximum number of bytes to fetch in a single batch
223+ cursor: The cursor object that will handle the results
224+ catalog_name: Optional catalog name pattern to filter by
225+ schema_name: Optional schema name pattern to filter by
226+
227+ Returns:
228+ ResultSet: An object containing the schema metadata
229+
230+ Raises:
231+ ValueError: If the session ID is invalid
232+ OperationalError: If there's an error retrieving the schemas
233+ """
149234 pass
150235
151236 @abstractmethod
@@ -160,6 +245,29 @@ def get_tables(
160245 table_name : Optional [str ] = None ,
161246 table_types : Optional [List [str ]] = None ,
162247 ) -> "ResultSet" :
248+ """
249+ Retrieves a list of tables, optionally filtered by catalog, schema, table name, and table types.
250+
251+ This method fetches metadata about tables available in the specified catalog
252+ and schema, or all catalogs and schemas if not specified.
253+
254+ Args:
255+ session_id: The session identifier
256+ max_rows: Maximum number of rows to fetch in a single batch
257+ max_bytes: Maximum number of bytes to fetch in a single batch
258+ cursor: The cursor object that will handle the results
259+ catalog_name: Optional catalog name pattern to filter by
260+ schema_name: Optional schema name pattern to filter by
261+ table_name: Optional table name pattern to filter by
262+ table_types: Optional list of table types to filter by (e.g., ['TABLE', 'VIEW'])
263+
264+ Returns:
265+ ResultSet: An object containing the table metadata
266+
267+ Raises:
268+ ValueError: If the session ID is invalid
269+ OperationalError: If there's an error retrieving the tables
270+ """
163271 pass
164272
165273 @abstractmethod
@@ -174,29 +282,28 @@ def get_columns(
174282 table_name : Optional [str ] = None ,
175283 column_name : Optional [str ] = None ,
176284 ) -> "ResultSet" :
177- pass
178-
179- # == Properties ==
180- @property
181- @abstractmethod
182- def staging_allowed_local_path (self ) -> Union [None , str , List [str ]]:
183285 """
184- Gets the allowed local paths for staging operations .
286+ Retrieves a list of columns, optionally filtered by catalog, schema, table, and column name patterns .
185287
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
288+ This method fetches metadata about columns available in the specified table,
289+ or all tables if not specified.
191290
192- @property
193- @abstractmethod
194- def ssl_options (self ) -> SSLOptions :
195- """
196- Gets the SSL options for this client.
291+ Args:
292+ session_id: The session identifier
293+ max_rows: Maximum number of rows to fetch in a single batch
294+ max_bytes: Maximum number of bytes to fetch in a single batch
295+ cursor: The cursor object that will handle the results
296+ catalog_name: Optional catalog name pattern to filter by
297+ schema_name: Optional schema name pattern to filter by
298+ table_name: Optional table name pattern to filter by
299+ column_name: Optional column name pattern to filter by
197300
198301 Returns:
199- SSLOptions: The SSL configuration options
302+ ResultSet: An object containing the column metadata
303+
304+ Raises:
305+ ValueError: If the session ID is invalid
306+ OperationalError: If there's an error retrieving the columns
200307 """
201308 pass
202309
0 commit comments