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

Commitb2202c7

Browse files
committed
Updated the non retying to only inline case
1 parentbf26881 commitb2202c7

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

‎src/databricks/sql/auth/retry.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CommandType(Enum):
3232
CLOSE_SESSION="CloseSession"
3333
CLOSE_OPERATION="CloseOperation"
3434
GET_OPERATION_STATUS="GetOperationStatus"
35-
FETCH_RESULTS_ORIENTATION_FETCH_NEXT="FetchResultsOrientation_FETCH_NEXT"
35+
FETCH_RESULTS_INLINE_FETCH_NEXT="FetchResultsInline_FETCH_NEXT"
3636
OTHER="Other"
3737

3838
@classmethod
@@ -363,10 +363,10 @@ def should_retry(self, method: str, status_code: int) -> Tuple[bool, str]:
363363
ifstatus_code==501:
364364
raiseNonRecoverableNetworkError("Received code 501 from server.")
365365

366-
ifself.command_type==CommandType.FETCH_RESULTS_ORIENTATION_FETCH_NEXT:
366+
ifself.command_type==CommandType.FETCH_RESULTS_INLINE_FETCH_NEXT:
367367
return (
368368
False,
369-
"FetchResults with FETCH_NEXT orientation are not idempotent in inline mode and is not retried",
369+
"FetchResultsin INLINE modewith FETCH_NEXT orientation are not idempotent and is not retried",
370370
)
371371

372372
# Request failed and this method is not retryable. We only retry POST requests.

‎src/databricks/sql/thrift_backend.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def __init__(
156156
)
157157

158158
# Cloud fetch
159+
self._use_cloud_fetch=kwargs.get("use_cloud_fetch",True)
160+
159161
self.max_download_threads=kwargs.get("max_download_threads",10)
160162

161163
self._ssl_options=ssl_options
@@ -374,10 +376,13 @@ def attempt_request(attempt):
374376

375377
# These three lines are no-ops if the v3 retry policy is not in use
376378
ifself.enable_v3_retries:
377-
# Not to retry when FetchResults has orientation as FETCH_NEXT as it is not idempotent
378-
ifthis_method_name=="FetchResults":
379+
# Not to retry when FetchResults in INLINE mode when it has orientation as FETCH_NEXT as it is not idempotent
380+
if (
381+
this_method_name=="FetchResults"
382+
andself._use_cloud_fetch==False
383+
):
379384
this_method_name+= (
380-
"Orientation_"
385+
"Inline_"
381386
+ttypes.TFetchOrientation._VALUES_TO_NAMES[
382387
request.orientation
383388
]

‎tests/unit/test_retry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ def test_sleep__retry_after_present(self, t_mock, retry_policy, error_history):
8787

8888
deftest_not_retryable__fetch_results_orientation_fetch_next(self,retry_policy):
8989
HTTP_STATUS_CODES= [200,429,503,504]
90-
retry_policy.command_type=CommandType.FETCH_RESULTS_ORIENTATION_FETCH_NEXT
90+
retry_policy.command_type=CommandType.FETCH_RESULTS_INLINE_FETCH_NEXT
9191
forstatus_codeinHTTP_STATUS_CODES:
9292
assertnotretry_policy.is_retry("METHOD_NAME",status_code=status_code)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp