Skip to content

fix(dbutils): accept pathlib.Path arguments in fs methods#1461

Open
nileshpatil6 wants to merge 2 commits into
databricks:mainfrom
nileshpatil6:fix/dbutils-pathlib-support
Open

fix(dbutils): accept pathlib.Path arguments in fs methods#1461
nileshpatil6 wants to merge 2 commits into
databricks:mainfrom
nileshpatil6:fix/dbutils-pathlib-support

Conversation

@nileshpatil6
Copy link
Copy Markdown

Fixes #1459

dbutils.fs methods only accepted plain strings, so passing a pathlib.Path failed even though Path is idiomatic in modern Python.

What changed

Added a small _as_str helper in databricks/sdk/dbutils.py that converts a Path to str and leaves strings untouched. Called it at the entry of every _FsUtil method that takes a path argument (ls, cp, mv, rm, mkdirs, head, put, mount, unmount, updateMount).

Tests

Added 7 unit tests (one per patched method) that pass a Path object and assert the underlying API is still called with a plain string.

Signed-off-by: nileshpatil6 technil6436@gmail.com

DBUtils fs methods only accepted string paths, raising an error when
pathlib.Path objects were passed. Since Path is the standard way to
handle paths in modern Python, convert Path to str at method entry
via a small _as_str helper.

Fixes databricks#1459

Signed-off-by: nileshpatil6 <technil6436@gmail.com>
Signed-off-by: nileshpatil6 <technil6436@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

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: 1461
  • Commit SHA: 2b974ef07b28573cb3e41d7727a264ea4ce8d5ad

Checks will be approved automatically on success.

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.

[ISSUE] DBUtils does not support Path objects.

1 participant