Refactor codebase to use a unified http client#668
Closed
vikrantpuppala wants to merge 4 commits intodatabricks:mainfrom
Closed
Refactor codebase to use a unified http client#668vikrantpuppala wants to merge 4 commits intodatabricks:mainfrom
vikrantpuppala wants to merge 4 commits intodatabricks:mainfrom
Conversation
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
jprakash-db
reviewed
Aug 8, 2025
| url=token_request_url, data=data, headers=headers, auth=IgnoreNetrcAuth() | ||
| # Use unified HTTP client | ||
| from databricks.sql.common.unified_http_client import IgnoreNetrcAuth | ||
| response = self.http_client.request( |
Contributor
There was a problem hiding this comment.
How is a static method using class http_client ?
| auth_provider=self.session.auth_provider, | ||
| host_url=self.session.host, | ||
| batch_size=self.telemetry_batch_size, | ||
| http_client=self.session.http_client, |
Contributor
There was a problem hiding this comment.
so we are not keeping different client for Telemetry ( I believe there is different retry behaviour for it )
src/databricks/sql/client.py
Outdated
|
|
||
| with open(local_file, "rb") as fh: | ||
| r = requests.put(url=presigned_url, data=fh, headers=headers) | ||
| r = self.connection.session.http_client.request('PUT', presigned_url, body=fh.read(), headers=headers) |
Contributor
There was a problem hiding this comment.
@sreekanth-db Can you discuss with @vikrantpuppala and integrate the new common client approach in volume operations
Comment on lines
178
to
200
| def upload_file(self, url: str, file_path: str, headers: Optional[Dict[str, str]] = None) -> urllib3.HTTPResponse: | ||
| """ | ||
| Upload a file using PUT method. | ||
|
|
||
| Args: | ||
| url: URL to upload to | ||
| file_path: Path to the file to upload | ||
| headers: Optional headers | ||
|
|
||
| Returns: | ||
| urllib3.HTTPResponse: The response from the server | ||
| """ | ||
| with open(file_path, 'rb') as file_obj: | ||
| return self.request('PUT', url, body=file_obj.read(), headers=headers) | ||
|
|
||
| def download_file(self, url: str, file_path: str, headers: Optional[Dict[str, str]] = None) -> None: | ||
| """ | ||
| Download a file using GET method. | ||
|
|
||
| Args: | ||
| url: URL to download from | ||
| file_path: Path where to save the downloaded file | ||
| headers: Optional headers |
Contributor
There was a problem hiding this comment.
don't think they should be part of the Http client
| session_id_hex=session_id_hex, | ||
| statement_id=statement_id, | ||
| chunk_id=chunk_id, | ||
| http_client=http_client, |
Contributor
There was a problem hiding this comment.
why is the order of params changed ?
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Description
Refactor codebase to use a unified http client
How is this tested?
Related Tickets & Documents