Skip to content

Commit 4a9ba21

Browse files
init hybrid
1 parent 165644c commit 4a9ba21

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def __init__(
125125

126126
super().__init__(ssl_options=ssl_options, **kwargs)
127127

128+
self.use_hybrid_disposition = kwargs.get("use_hybrid_disposition", False)
129+
128130
# Extract warehouse ID from http_path
129131
self.warehouse_id = self._extract_warehouse_id(http_path)
130132

@@ -449,7 +451,11 @@ def execute_command(
449451
ResultFormat.ARROW_STREAM if use_cloud_fetch else ResultFormat.JSON_ARRAY
450452
).value
451453
disposition = (
452-
ResultDisposition.EXTERNAL_LINKS
454+
(
455+
ResultDisposition.HYBRID
456+
if self.use_hybrid_disposition
457+
else ResultDisposition.EXTERNAL_LINKS
458+
)
453459
if use_cloud_fetch
454460
else ResultDisposition.INLINE
455461
).value
@@ -630,7 +636,7 @@ def get_execution_result(
630636
arraysize=cursor.arraysize,
631637
)
632638

633-
def get_chunk_link(self, statement_id: str, chunk_index: int) -> ExternalLink:
639+
def get_chunk_links(self, statement_id: str, chunk_index: int) -> List[ExternalLink]:
634640
"""
635641
Get links for chunks starting from the specified index.
636642
Args:
@@ -647,17 +653,7 @@ def get_chunk_link(self, statement_id: str, chunk_index: int) -> ExternalLink:
647653
response = GetChunksResponse.from_dict(response_data)
648654

649655
links = response.external_links
650-
link = next((l for l in links if l.chunk_index == chunk_index), None)
651-
if not link:
652-
raise ServerOperationError(
653-
f"No link found for chunk index {chunk_index}",
654-
{
655-
"operation-id": statement_id,
656-
"diagnostic-info": None,
657-
},
658-
)
659-
660-
return link
656+
return links
661657

662658
# == Metadata Operations ==
663659

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ResultFormat(Enum):
2828
class ResultDisposition(Enum):
2929
"""Enum for result disposition values."""
3030

31-
# TODO: add support for hybrid disposition
31+
HYBRID = "INLINE_OR_EXTERNAL_LINKS"
3232
EXTERNAL_LINKS = "EXTERNAL_LINKS"
3333
INLINE = "INLINE"
3434

src/databricks/sql/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def __init__(
8787
Connect to a Databricks SQL endpoint or a Databricks cluster.
8888
8989
Parameters:
90+
:param use_sea: `bool`, optional (default is False)
91+
Use the SEA backend instead of the Thrift backend.
92+
:param use_hybrid_disposition: `bool`, optional (default is False)
93+
Use the hybrid disposition instead of the inline disposition.
9094
:param server_hostname: Databricks instance host name.
9195
:param http_path: Http path either to a DBSQL endpoint (e.g. /sql/1.0/endpoints/1234567890abcdef)
9296
or to a DBR interactive cluster (e.g. /sql/protocolv1/o/1234567890123456/1234-123456-slid123)

0 commit comments

Comments
 (0)