Skip to content

Commit 2d44596

Browse files
add get_chunk_link s
Signed-off-by: varun-edachali-dbx <[email protected]>
1 parent 26f8947 commit 2d44596

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/databricks/sql/backend/sea/backend.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
import re
66
from typing import Any, Dict, Tuple, List, Optional, Union, TYPE_CHECKING, Set
77

8-
from databricks.sql.backend.sea.models.base import ResultManifest, StatementStatus
8+
from databricks.sql.backend.sea.models.base import (
9+
ExternalLink,
10+
ResultManifest,
11+
StatementStatus,
12+
)
13+
from databricks.sql.backend.sea.models.responses import GetChunksResponse
914
from databricks.sql.backend.sea.utils.constants import (
1015
ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP,
1116
ResultFormat,
@@ -647,6 +652,27 @@ def get_execution_result(
647652
response = self._poll_query(command_id)
648653
return self._response_to_result_set(response, cursor)
649654

655+
def get_chunk_links(
656+
self, statement_id: str, chunk_index: int
657+
) -> List[ExternalLink]:
658+
"""
659+
Get links for chunks starting from the specified index.
660+
Args:
661+
statement_id: The statement ID
662+
chunk_index: The starting chunk index
663+
Returns:
664+
ExternalLink: External link for the chunk
665+
"""
666+
667+
response_data = self._http_client._make_request(
668+
method="GET",
669+
path=self.CHUNK_PATH_WITH_ID_AND_INDEX.format(statement_id, chunk_index),
670+
)
671+
response = GetChunksResponse.from_dict(response_data)
672+
673+
links = response.external_links or []
674+
return links
675+
650676
# == Metadata Operations ==
651677

652678
def get_catalogs(

src/databricks/sql/backend/sea/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
ExecuteStatementResponse,
2727
GetStatementResponse,
2828
CreateSessionResponse,
29+
GetChunksResponse,
2930
)
3031

3132
__all__ = [
@@ -47,4 +48,5 @@
4748
"ExecuteStatementResponse",
4849
"GetStatementResponse",
4950
"CreateSessionResponse",
51+
"GetChunksResponse",
5052
]

0 commit comments

Comments
 (0)