Open
Conversation
|
Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes. |
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This was referenced Feb 19, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 11, 2026
…1295) ## 🥞 Stacked PR Use this [link](https://github.com/databricks/databricks-sdk-py/pull/1295/files) to review incremental changes. - [**stack/refactor-files-client-3**](#1295) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1295/files)] - [stack/refactor-files-client-4](#1319) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1319/files/9e504b191ad065bf8adbeb003fa493ba51bcc165..8218fc4ae84ff4b9ec2f838b26faa0c3a957f2e5)] - [stack/refactor-files-client-5](#1324) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1324/files/8218fc4ae84ff4b9ec2f838b26faa0c3a957f2e5..2c4f3e63287e86b0984a4dfb323547cdaacfa058)] --------- ## Summary Extracts the presigned URL coordination logic (`create-upload-part-urls` and `create-resumable-upload-url` API calls and response parsing) into a dedicated `_PresignedUrlRequestBuilder` class, replacing inline code in three upload methods. ## Why The `create-upload-part-urls` API call, response validation, and header parsing was duplicated across `_do_upload_one_part`, `_perform_multipart_upload`, and `_perform_resumable_upload` (with a similar pattern for `create-resumable-upload-url`). Each copy built the request body, called `_api.do()`, validated the response structure, and converted the headers list to a dict — all inline. This made the upload methods longer than necessary and meant any change to the coordination logic required updating multiple places. `_PresignedUrlRequestBuilder` consolidates this into a single class. It also prepares for storage-proxy routing (#1278), where a different builder implementation can construct URLs directly instead of calling the presigned URL APIs. ## What changed ### Interface changes None. All changes are to private methods. ### Behavioral changes - Malformed presigned URL responses (`ValueError`/`KeyError` from response parsing) now trigger fallback to single-shot upload on the first part, instead of propagating as hard errors. Previously the `_api.do()` call was wrapped in `try/except` but the response parsing was outside it. Now both are encapsulated in the builder, so parsing errors are also caught. This is more resilient — a broken coordination response should not abort the upload when a simpler path exists. ### Internal changes - **`_PresignedUrl`** — new dataclass holding a resolved presigned URL and its associated headers. - **`_PresignedUrlRequestBuilder`** — new class with `build_upload_part_urls()` and `build_resumable_upload_url()`. Encapsulates the coordination API calls and response parsing. - **`_do_upload_one_part`** — replaced inline `create-upload-part-urls` call and response parsing with `builder.build_upload_part_urls(..., count=1)[0]`. - **`_perform_multipart_upload`** — replaced inline `create-upload-part-urls` batch call and response parsing with `builder.build_upload_part_urls(..., count=batch_size)`. - **`_perform_resumable_upload`** — replaced inline `create-resumable-upload-url` call and response parsing with `builder.build_resumable_upload_url()`. ## How is this tested? Unit tests. NO_CHANGELOG=true
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.
🥞 Stacked PR
Use this link to review incremental changes.
What changes are proposed in this pull request?
Provide the readers and reviewers with the information they need to understand
this PR in a comprehensive manner.
Specifically, try to answer the two following questions:
major changes to allow the reader to quickly understand the PR without having
to look at the code.
reader might be missing. For example, were there any decisions behind the
change that are not reflected in the code itself?
The “why part” is the most important of the two as it usually cannot be
inferred from the code itself. A well-written PR description will help future
developers (including your future self) to know how to interact and update your
code.
How is this tested?
Describe any tests you have done; especially if test tests are not part of
the unit tests (e.g. local tests).
ALWAYS ANSWER THIS QUESTION: Answer with "N/A" if tests are not applicable
to your PR (e.g. if the PR only modifies comments). Do not be afraid of
answering "Not tested" if the PR has not been tested. Being clear about what
has been done and not done provides important context to the reviewers.