- Notifications
You must be signed in to change notification settings - Fork126
Implement ResultSet Abstraction (backend interfaces for fetch phase)#574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
8ea5cf43eba92a6735fd512388e8853e6c34f8b54c12ee56fa5152d02c2984e49794226361e85904c304e5ac8c6e06fd2f7126f97b1245dab54b04ae1d7f711c721e0f1fa67a512d37cff0ec64c5900c9c86e99bbcd6f01ca51d1dd403fcd1b4154ceac04331b0fc9bb45871e561c351a3188adff7abf6e7e2333fd4fae6677e66a4ec87036ecb6bffe2ce17568b1f4ebbd150aa8af45e7be76b7461715b295acd8afc5d5b8f91467c733ee0917ea13fd2a4603d3ae7fb0fa46e3770cd3b8002ff1a350a98b0dc7afee4232d24fdda5561e80d890a5c2aa762fe642da394333cef07acd1ef46cf76ca997afc6f8ff6660ba9871a93595d79510ee9403d75d6cb8e1bbddac08f27b0cbed9267ef95f0053259ed5cec95951d335d918ee4f94c1c8bb119de280e04b626a2a01173b1faa09270edcf8523fd3763f0701e0d9d5890cdd79bdee1dcdd7a19fcc2da9d354309d63544e5bbf2239c62b217bb7ca6438a080eb504112a5b9c7d31aa593e62c90f9a6b13a941575032c276d36889d22e5ce477724038b27150398db45c962b63c246872326f33837e73a93d7123c132e1b746090c028249c05ab0a2c6528cd18f7754bf7d386561cc398554d0116f28297983ec036f3b5b729a28400d28b698cb8cdd4495f9bc744117ef5a06babbaaa533765cb788d8c74debbd30e6e215925394c4ad6c8d51369c89541464cbdd3d7ca38e95b40c0fd35ed46237f3af109c5e2f4ce6aab307f447802d8dc944d44663380833658a918ef6ed661300b244e7d17d2035ea8b4451bd21d2c321068a3476e7631e1cf1eb408c2c73649f2a61df99e1a2c0e71ba9d5160ba9f6b3436f30849dc4d455bb6fc0834d254e48370627dca1b57d6c120c0cdf686512ce7171215fd8dd083f68d30436066aef91ed3514ca80f946027fb17a2f9b539294e9709e9101ad0ace913da63d8159e70b91183ff78b5fc1d53d2a5a8e51f7be10ca888dd629a29859b9735e0a8226c42263c4ac984e48da84e8f4f27e34e3ccce04eb8c1ca425eb7a47dd000d9aebeecc67d9800636e07f56c73fb141d8386536654f0689425f993e55e87689d751ec8c4580b7bc3904efe7c91bc377f6073d1dada972603f37ad97cc4d4ce10f6297f7b536387b7a6237e9b6afd2d80a3e288996e01bec8e9af166b9ac347327e730dbdfb4cc36a9f0e20b2e83f1f0c81faa7207efde463454f2b93db73ecfcf8a629File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,10 +15,16 @@ | ||
| from databricks.sql.client import Cursor | ||
| from databricks.sql.thrift_api.TCLIService import ttypes | ||
| from databricks.sql.backend.types import SessionId, CommandId, CommandState | ||
| from databricks.sql.utils import ExecuteResponse | ||
| from databricks.sql.types import SSLOptions | ||
| # Forward reference for type hints | ||
| from typing import TYPE_CHECKING | ||
| if TYPE_CHECKING: | ||
| from databricks.sql.result_set import ResultSet | ||
| class DatabricksClient(ABC): | ||
| # == Connection and Session Management == | ||
| @@ -81,7 +87,7 @@ def execute_command( | ||
| parameters: List[ttypes.TSparkParameter], | ||
| async_op: bool, | ||
| enforce_embedded_schema_correctness: bool, | ||
| ) ->Union["ResultSet", None]: | ||
| """ | ||
| Executes a SQL command or query within the specified session. | ||
| @@ -101,7 +107,7 @@ def execute_command( | ||
| enforce_embedded_schema_correctness: Whether to enforce schema correctness | ||
| Returns: | ||
| If async_op is False, returnsa ResultSet object containing the | ||
| query results and metadata. If async_op is True, returns None and the | ||
| results must be fetched later using get_execution_result(). | ||
| @@ -130,7 +136,7 @@ def cancel_command(self, command_id: CommandId) -> None: | ||
| pass | ||
| @abstractmethod | ||
| def close_command(self, command_id: CommandId) ->None: | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. why changed to void/none? if you choose to return void, make sure the implementations throw appropriate errors for the calling code ContributorAuthor
| ||
| """ | ||
| Closes a command and releases associated resources. | ||
| @@ -140,17 +146,14 @@ def close_command(self, command_id: CommandId) -> ttypes.TStatus: | ||
| Args: | ||
| command_id: The command identifier to close | ||
| Raises: | ||
| ValueError: If the command ID is invalid | ||
| OperationalError: If there's an error closing the command | ||
| """ | ||
| pass | ||
| @abstractmethod | ||
| def get_query_state(self, command_id: CommandId) ->CommandState: | ||
| """ | ||
| Gets the current state of a query or command. | ||
| @@ -160,7 +163,7 @@ def get_query_state(self, command_id: CommandId) -> ttypes.TOperationState: | ||
| command_id: The command identifier to check | ||
| Returns: | ||
| CommandState: The current state of the command | ||
| Raises: | ||
| ValueError: If the command ID is invalid | ||
| @@ -175,7 +178,7 @@ def get_execution_result( | ||
| self, | ||
| command_id: CommandId, | ||
| cursor: "Cursor", | ||
| ) ->"ResultSet": | ||
varun-edachali-dbx marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| """ | ||
| Retrieves the results of a previously executed command. | ||
| @@ -187,7 +190,7 @@ def get_execution_result( | ||
| cursor: The cursor object that will handle the results | ||
| Returns: | ||
| ResultSet: An object containing the query results and metadata | ||
| Raises: | ||
| ValueError: If the command ID is invalid | ||
| @@ -203,7 +206,7 @@ def get_catalogs( | ||
| max_rows: int, | ||
| max_bytes: int, | ||
| cursor: "Cursor", | ||
| ) ->"ResultSet": | ||
| """ | ||
| Retrieves a list of available catalogs. | ||
| @@ -217,7 +220,7 @@ def get_catalogs( | ||
| cursor: The cursor object that will handle the results | ||
| Returns: | ||
| ResultSet: An object containing the catalog metadata | ||
| Raises: | ||
| ValueError: If the session ID is invalid | ||
| @@ -234,7 +237,7 @@ def get_schemas( | ||
| cursor: "Cursor", | ||
| catalog_name: Optional[str] = None, | ||
| schema_name: Optional[str] = None, | ||
| ) ->"ResultSet": | ||
| """ | ||
| Retrieves a list of schemas, optionally filtered by catalog and schema name patterns. | ||
| @@ -250,7 +253,7 @@ def get_schemas( | ||
| schema_name: Optional schema name pattern to filter by | ||
| Returns: | ||
| ResultSet: An object containing the schema metadata | ||
| Raises: | ||
| ValueError: If the session ID is invalid | ||
| @@ -269,7 +272,7 @@ def get_tables( | ||
| schema_name: Optional[str] = None, | ||
| table_name: Optional[str] = None, | ||
| table_types: Optional[List[str]] = None, | ||
| ) ->"ResultSet": | ||
| """ | ||
| Retrieves a list of tables, optionally filtered by catalog, schema, table name, and table types. | ||
| @@ -287,7 +290,7 @@ def get_tables( | ||
| table_types: Optional list of table types to filter by (e.g., ['TABLE', 'VIEW']) | ||
| Returns: | ||
| ResultSet: An object containing the table metadata | ||
| Raises: | ||
| ValueError: If the session ID is invalid | ||
| @@ -306,7 +309,7 @@ def get_columns( | ||
| schema_name: Optional[str] = None, | ||
| table_name: Optional[str] = None, | ||
| column_name: Optional[str] = None, | ||
| ) ->"ResultSet": | ||
| """ | ||
| Retrieves a list of columns, optionally filtered by catalog, schema, table, and column name patterns. | ||
| @@ -324,7 +327,7 @@ def get_columns( | ||
| column_name: Optional column name pattern to filter by | ||
| Returns: | ||
| ResultSet: An object containing the column metadata | ||
| Raises: | ||
| ValueError: If the session ID is invalid | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.