Skip to content

update#1278

Open
parthban-db wants to merge 1 commit intomainfrom
parthban-db/stack/files-dp-endpoint
Open

update#1278
parthban-db wants to merge 1 commit intomainfrom
parthban-db/stack/files-dp-endpoint

Conversation

@parthban-db
Copy link
Contributor

@parthban-db parthban-db commented Feb 19, 2026

🥞 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:

  • WHAT changes are being made in the PR? This should be a summary of the
    major changes to allow the reader to quickly understand the PR without having
    to look at the code.
  • WHY are these changes needed? This should provide the context that the
    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.

@github-actions
Copy link

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1278
  • Commit SHA: becd26b0706ba8d8f186a265a0864df4570ff966

Checks will be approved automatically on success.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant