Skip to content

Commit d4ce10f

Browse files
add back accidentally removed docstrings
Signed-off-by: varun-edachali-dbx <[email protected]>
1 parent ad97cc4 commit d4ce10f

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

src/databricks/sql/backend/databricks_client.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@ def execute_command(
8888
async_op: bool,
8989
enforce_embedded_schema_correctness: bool,
9090
) -> Union["ResultSet", None]:
91+
"""
92+
Executes a SQL command or query within the specified session.
93+
This method sends a SQL command to the server for execution and handles
94+
the response. It can operate in both synchronous and asynchronous modes.
95+
Args:
96+
operation: The SQL command or query to execute
97+
session_id: The session identifier in which to execute the command
98+
max_rows: Maximum number of rows to fetch in a single fetch batch
99+
max_bytes: Maximum number of bytes to fetch in a single fetch batch
100+
lz4_compression: Whether to use LZ4 compression for result data
101+
cursor: The cursor object that will handle the results
102+
use_cloud_fetch: Whether to use cloud fetch for retrieving large result sets
103+
parameters: List of parameters to bind to the query
104+
async_op: Whether to execute the command asynchronously
105+
enforce_embedded_schema_correctness: Whether to enforce schema correctness
106+
Returns:
107+
If async_op is False, returns an ExecuteResponse object containing the
108+
query results and metadata. If async_op is True, returns None and the
109+
results must be fetched later using get_execution_result().
110+
Raises:
111+
ValueError: If the session ID is invalid
112+
OperationalError: If there's an error executing the command
113+
ServerOperationError: If the server encounters an error during execution
114+
"""
91115
pass
92116

93117
@abstractmethod
@@ -151,6 +175,19 @@ def get_execution_result(
151175
command_id: CommandId,
152176
cursor: "Cursor",
153177
) -> "ResultSet":
178+
"""
179+
Retrieves the results of a previously executed command.
180+
This method fetches the results of a command that was executed asynchronously
181+
or retrieves additional results from a command that has more rows available.
182+
Args:
183+
command_id: The command identifier for which to retrieve results
184+
cursor: The cursor object that will handle the results
185+
Returns:
186+
ExecuteResponse: An object containing the query results and metadata
187+
Raises:
188+
ValueError: If the command ID is invalid
189+
OperationalError: If there's an error retrieving the results
190+
"""
154191
pass
155192

156193
# == Metadata Operations ==
@@ -162,6 +199,21 @@ def get_catalogs(
162199
max_bytes: int,
163200
cursor: "Cursor",
164201
) -> "ResultSet":
202+
"""
203+
Retrieves a list of available catalogs.
204+
This method fetches metadata about all catalogs available in the current
205+
session's context.
206+
Args:
207+
session_id: The session identifier
208+
max_rows: Maximum number of rows to fetch in a single batch
209+
max_bytes: Maximum number of bytes to fetch in a single batch
210+
cursor: The cursor object that will handle the results
211+
Returns:
212+
ExecuteResponse: An object containing the catalog metadata
213+
Raises:
214+
ValueError: If the session ID is invalid
215+
OperationalError: If there's an error retrieving the catalogs
216+
"""
165217
pass
166218

167219
@abstractmethod
@@ -174,6 +226,23 @@ def get_schemas(
174226
catalog_name: Optional[str] = None,
175227
schema_name: Optional[str] = None,
176228
) -> "ResultSet":
229+
"""
230+
Retrieves a list of schemas, optionally filtered by catalog and schema name patterns.
231+
This method fetches metadata about schemas available in the specified catalog
232+
or all catalogs if no catalog is specified.
233+
Args:
234+
session_id: The session identifier
235+
max_rows: Maximum number of rows to fetch in a single batch
236+
max_bytes: Maximum number of bytes to fetch in a single batch
237+
cursor: The cursor object that will handle the results
238+
catalog_name: Optional catalog name pattern to filter by
239+
schema_name: Optional schema name pattern to filter by
240+
Returns:
241+
ExecuteResponse: An object containing the schema metadata
242+
Raises:
243+
ValueError: If the session ID is invalid
244+
OperationalError: If there's an error retrieving the schemas
245+
"""
177246
pass
178247

179248
@abstractmethod
@@ -188,6 +257,25 @@ def get_tables(
188257
table_name: Optional[str] = None,
189258
table_types: Optional[List[str]] = None,
190259
) -> "ResultSet":
260+
"""
261+
Retrieves a list of tables, optionally filtered by catalog, schema, table name, and table types.
262+
This method fetches metadata about tables available in the specified catalog
263+
and schema, or all catalogs and schemas if not specified.
264+
Args:
265+
session_id: The session identifier
266+
max_rows: Maximum number of rows to fetch in a single batch
267+
max_bytes: Maximum number of bytes to fetch in a single batch
268+
cursor: The cursor object that will handle the results
269+
catalog_name: Optional catalog name pattern to filter by
270+
schema_name: Optional schema name pattern to filter by
271+
table_name: Optional table name pattern to filter by
272+
table_types: Optional list of table types to filter by (e.g., ['TABLE', 'VIEW'])
273+
Returns:
274+
ExecuteResponse: An object containing the table metadata
275+
Raises:
276+
ValueError: If the session ID is invalid
277+
OperationalError: If there's an error retrieving the tables
278+
"""
191279
pass
192280

193281
@abstractmethod

0 commit comments

Comments
 (0)