Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab2e43d

Browse files
Revert "Complete Fetch Phase (EXTERNAL_LINKS disposition andARROW format) (#598)"
This reverts commit1a0575a.
1 parent0d6b53c commitab2e43d

File tree

17 files changed

+331
-1294
lines changed

17 files changed

+331
-1294
lines changed

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importre
66
fromtypingimportAny,Dict,Tuple,List,Optional,Union,TYPE_CHECKING,Set
77

8-
fromdatabricks.sql.backend.sea.models.baseimportExternalLink,ResultManifest
8+
fromdatabricks.sql.backend.sea.models.baseimportResultManifest
99
fromdatabricks.sql.backend.sea.utils.constantsimport (
1010
ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP,
1111
ResultFormat,
@@ -29,7 +29,7 @@
2929
BackendType,
3030
ExecuteResponse,
3131
)
32-
fromdatabricks.sql.excimportDatabaseError,ServerOperationError
32+
fromdatabricks.sql.excimportDatabaseError,ProgrammingError,ServerOperationError
3333
fromdatabricks.sql.backend.sea.utils.http_clientimportSeaHttpClient
3434
fromdatabricks.sql.typesimportSSLOptions
3535

@@ -45,7 +45,6 @@
4545
GetStatementResponse,
4646
CreateSessionResponse,
4747
)
48-
fromdatabricks.sql.backend.sea.models.responsesimportGetChunksResponse
4948

5049
logger=logging.getLogger(__name__)
5150

@@ -90,7 +89,6 @@ class SeaDatabricksClient(DatabricksClient):
9089
STATEMENT_PATH=BASE_PATH+"statements"
9190
STATEMENT_PATH_WITH_ID=STATEMENT_PATH+"/{}"
9291
CANCEL_STATEMENT_PATH_WITH_ID=STATEMENT_PATH+"/{}/cancel"
93-
CHUNK_PATH_WITH_ID_AND_INDEX=STATEMENT_PATH+"/{}/result/chunks/{}"
9492

9593
# SEA constants
9694
POLL_INTERVAL_SECONDS=0.2
@@ -137,13 +135,13 @@ def __init__(
137135
self.warehouse_id=self._extract_warehouse_id(http_path)
138136

139137
# Initialize HTTP client
140-
self._http_client=SeaHttpClient(
138+
self.http_client=SeaHttpClient(
141139
server_hostname=server_hostname,
142140
port=port,
143141
http_path=http_path,
144142
http_headers=http_headers,
145143
auth_provider=auth_provider,
146-
ssl_options=self._ssl_options,
144+
ssl_options=ssl_options,
147145
**kwargs,
148146
)
149147

@@ -182,7 +180,7 @@ def _extract_warehouse_id(self, http_path: str) -> str:
182180
f"Note: SEA only works for warehouses."
183181
)
184182
logger.error(error_message)
185-
raiseValueError(error_message)
183+
raiseProgrammingError(error_message)
186184

187185
@property
188186
defmax_download_threads(self)->int:
@@ -229,7 +227,7 @@ def open_session(
229227
schema=schema,
230228
)
231229

232-
response=self._http_client._make_request(
230+
response=self.http_client._make_request(
233231
method="POST",path=self.SESSION_PATH,data=request_data.to_dict()
234232
)
235233

@@ -254,7 +252,7 @@ def close_session(self, session_id: SessionId) -> None:
254252
session_id: The session identifier returned by open_session()
255253
256254
Raises:
257-
ValueError: If the session ID is invalid
255+
ProgrammingError: If the session ID is invalid
258256
OperationalError: If there's an error closing the session
259257
"""
260258

@@ -269,7 +267,7 @@ def close_session(self, session_id: SessionId) -> None:
269267
session_id=sea_session_id,
270268
)
271269

272-
self._http_client._make_request(
270+
self.http_client._make_request(
273271
method="DELETE",
274272
path=self.SESSION_PATH_WITH_ID.format(sea_session_id),
275273
data=request_data.to_dict(),
@@ -351,7 +349,7 @@ def _results_message_to_execute_response(
351349

352350
# Check for compression
353351
lz4_compressed= (
354-
response.manifest.result_compression==ResultCompression.LZ4_FRAME.value
352+
response.manifest.result_compression==ResultCompression.LZ4_FRAME
355353
)
356354

357355
execute_response=ExecuteResponse(
@@ -457,7 +455,7 @@ def execute_command(
457455
enforce_embedded_schema_correctness: Whether to enforce schema correctness
458456
459457
Returns:
460-
SeaResultSet: A SeaResultSet instance for the executed command
458+
ResultSet: A SeaResultSet instance for the executed command
461459
"""
462460

463461
ifsession_id.backend_type!=BackendType.SEA:
@@ -508,7 +506,7 @@ def execute_command(
508506
result_compression=result_compression,
509507
)
510508

511-
response_data=self._http_client._make_request(
509+
response_data=self.http_client._make_request(
512510
method="POST",path=self.STATEMENT_PATH,data=request.to_dict()
513511
)
514512
response=ExecuteStatementResponse.from_dict(response_data)
@@ -545,7 +543,7 @@ def cancel_command(self, command_id: CommandId) -> None:
545543
command_id: Command identifier to cancel
546544
547545
Raises:
548-
ValueError: If the command ID is invalid
546+
ProgrammingError: If the command ID is invalid
549547
"""
550548

551549
ifcommand_id.backend_type!=BackendType.SEA:
@@ -556,7 +554,7 @@ def cancel_command(self, command_id: CommandId) -> None:
556554
raiseValueError("Not a valid SEA command ID")
557555

558556
request=CancelStatementRequest(statement_id=sea_statement_id)
559-
self._http_client._make_request(
557+
self.http_client._make_request(
560558
method="POST",
561559
path=self.CANCEL_STATEMENT_PATH_WITH_ID.format(sea_statement_id),
562560
data=request.to_dict(),
@@ -570,7 +568,7 @@ def close_command(self, command_id: CommandId) -> None:
570568
command_id: Command identifier to close
571569
572570
Raises:
573-
ValueError: If the command ID is invalid
571+
ProgrammingError: If the command ID is invalid
574572
"""
575573

576574
ifcommand_id.backend_type!=BackendType.SEA:
@@ -581,7 +579,7 @@ def close_command(self, command_id: CommandId) -> None:
581579
raiseValueError("Not a valid SEA command ID")
582580

583581
request=CloseStatementRequest(statement_id=sea_statement_id)
584-
self._http_client._make_request(
582+
self.http_client._make_request(
585583
method="DELETE",
586584
path=self.STATEMENT_PATH_WITH_ID.format(sea_statement_id),
587585
data=request.to_dict(),
@@ -600,7 +598,7 @@ def _poll_query(self, command_id: CommandId) -> GetStatementResponse:
600598
raiseValueError("Not a valid SEA command ID")
601599

602600
request=GetStatementRequest(statement_id=sea_statement_id)
603-
response_data=self._http_client._make_request(
601+
response_data=self.http_client._make_request(
604602
method="GET",
605603
path=self.STATEMENT_PATH_WITH_ID.format(sea_statement_id),
606604
data=request.to_dict(),

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
ExecuteStatementResponse,
2828
GetStatementResponse,
2929
CreateSessionResponse,
30-
GetChunksResponse,
3130
)
3231

3332
__all__= [
@@ -50,5 +49,4 @@
5049
"ExecuteStatementResponse",
5150
"GetStatementResponse",
5251
"CreateSessionResponse",
53-
"GetChunksResponse",
5452
]

‎src/databricks/sql/backend/sea/models/responses.py‎

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -160,37 +160,3 @@ class CreateSessionResponse:
160160
deffrom_dict(cls,data:Dict[str,Any])->"CreateSessionResponse":
161161
"""Create a CreateSessionResponse from a dictionary."""
162162
returncls(session_id=data.get("session_id",""))
163-
164-
165-
@dataclass
166-
classGetChunksResponse:
167-
"""
168-
Response from getting chunks for a statement.
169-
170-
The response model can be found in the docs, here:
171-
https://docs.databricks.com/api/workspace/statementexecution/getstatementresultchunkn
172-
"""
173-
174-
data:Optional[List[List[Any]]]=None
175-
external_links:Optional[List[ExternalLink]]=None
176-
byte_count:Optional[int]=None
177-
chunk_index:Optional[int]=None
178-
next_chunk_index:Optional[int]=None
179-
next_chunk_internal_link:Optional[str]=None
180-
row_count:Optional[int]=None
181-
row_offset:Optional[int]=None
182-
183-
@classmethod
184-
deffrom_dict(cls,data:Dict[str,Any])->"GetChunksResponse":
185-
"""Create a GetChunksResponse from a dictionary."""
186-
result=_parse_result({"result":data})
187-
returncls(
188-
data=result.data,
189-
external_links=result.external_links,
190-
byte_count=result.byte_count,
191-
chunk_index=result.chunk_index,
192-
next_chunk_index=result.next_chunk_index,
193-
next_chunk_internal_link=result.next_chunk_internal_link,
194-
row_count=result.row_count,
195-
row_offset=result.row_offset,
196-
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp