Skip to content

Commit 8576f31

Browse files
allow DELETE in retries
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 8d8f730 commit 8576f31

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/databricks/sql/auth/retry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(
127127
total=_attempts_remaining,
128128
respect_retry_after_header=True,
129129
backoff_factor=self.delay_min,
130-
allowed_methods=["POST"],
130+
allowed_methods=["POST", "DELETE"],
131131
status_forcelist=[429, 503, *self.force_dangerous_codes],
132132
)
133133

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,14 @@ def __init__(
180180
# Extract retry policy parameters
181181
self._initialize_retry_args(kwargs)
182182
self._auth_provider = auth_provider
183+
183184
self.enable_v3_retries = kwargs.get("_enable_v3_retries", True)
185+
if not self.enable_v3_retries:
186+
logger.warning(
187+
"Legacy retry behavior is enabled for this connection."
188+
" This behaviour is deprecated and will be removed in a future release."
189+
)
190+
184191
self.force_dangerous_codes = kwargs.get("_retry_dangerous_codes", [])
185192

186193
additional_transport_args = {}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ def get(
9292
Returns:
9393
Response data parsed from JSON
9494
"""
95-
# Set the command type for retry policy
96-
command_type = self._determine_command_type(path, "GET", None)
97-
self.thrift_client.set_retry_command_type(command_type)
98-
9995
return self.thrift_client.make_rest_request(
10096
"GET", path, params=params, headers=headers
10197
)
@@ -119,10 +115,6 @@ def post(
119115
Returns:
120116
Response data parsed from JSON
121117
"""
122-
# Set the command type for retry policy
123-
command_type = self._determine_command_type(path, "POST", data)
124-
self.thrift_client.set_retry_command_type(command_type)
125-
126118
response = self.thrift_client.make_rest_request(
127119
"POST", path, data=data, params=params, headers=headers
128120
)
@@ -147,10 +139,6 @@ def delete(
147139
Returns:
148140
Response data parsed from JSON
149141
"""
150-
# Set the command type for retry policy
151-
command_type = self._determine_command_type(path, "DELETE", data)
152-
self.thrift_client.set_retry_command_type(command_type)
153-
154142
return self.thrift_client.make_rest_request(
155143
"DELETE", path, data=data, params=params, headers=headers
156144
)

0 commit comments

Comments
 (0)