Skip to main content

fsspec-databricks

PyPI - Version codecov

File system interface for Databricks file system"s".

fsspec-databricks provides a fsspec-compliant file system implementation that unifies access to Databricks file systems, including:

The library routes dbfs:/ and POSIX-style paths to the appropriate Databricks file system implementation and supports copying and streaming between them.


Features

  • Provides seamless access to files in different Databricks file systems with DBFS URLs (dbfs:/path/to/file) or POSIX paths (/path/to/file).
    • Automatically routes file operations to appropriate file systems based on file path patterns.
    • Implements file operations across different file systems, for example, copying a file from Workspace to Unity Catalog Volume or vice versa.
  • Falls back to the local file system when running inside a Databricks workspace.
  • Implemented on Databricks Python SDK.

Compatibility

  • Python 3.10 to 3.14
  • databricks-sdk: 0.99.0 or later
  • fsspec: 2024.6.0 or later
  • aiohttp: 3.12.0 or later
  • Databricks workspace: Tested on the following environments at the moment.
    • Databricks Free Edition
    • Azure Databricks
    • Databricks on Google Cloud

Project status

The current status of this library is early beta. Its API and behavior are subject to change during further development and testing.

  • The current version relies on the undocumented multipart upload API for Unity Catalog Volume file write, which Databricks does not officially support and may change without notice.
  • For more details about the current limitations, see the Limitations section below.

Getting started

Installation

You can install fsspec-databricks from PyPI.

# with pip
pip install fsspec-databricks
# with UV
uv add fsspec-databricks

Usage

Then you can directly instantiate DatabricksFileSystem in fsspec_databricks module.

from fsspec_databricks import DatabricksFileSystem

fs = DatabricksFileSystem()

Or, you can register DatabricksFileSystem as the default file system implementation for dbfs:/ URL scheme by calling fsspec_databricks.use().

import fsspec
import fsspec_databricks

fsspec_databricks.use()

fs = fsspec.filesystem("dbfs")  # DatabricksFileSystem

For more details on how to use the fsspec file system objects, see fsspec's documentation.

For detailed usage — common operations, POSIX paths, backend-specific behaviour and configuration parameters, see USAGE.md.

Supported file paths

fsspec-databricks supports file paths with dbfs:/ scheme.

It uses the same path patterns as Databricks to map dbfs:/ and POSIX paths to the appropriate file system implementation.

URL pattern Mapped file system
dbfs:/Volumes/(catalog)/(schema)/(volume)/path/to/file Unity Catalog Volume file system
dbfs:/Workspace/path/to/file Databricks Workspace file system
dbfs:/... (other than above) Legacy DBFS (deprecated)

Examples:

fs.ls("dbfs:/Volumes/my_catalog/my_schema/my_volume/path")  # Access Unity Catalog Volume files
fs.ls("dbfs:/Workspace/Users/user-a/path")  # Access workspace files
fs.ls("dbfs:/data/path")  # Access legacy DBFS files

fsspec-databricks supports also stripped, POSIX-like paths without dbfs:/ scheme.

Path pattern Mapped file system
/Volumes/(catalog)/(schema)/(volume)/path/to/file Unity Catalog Volume file system
/Workspace/path/to/file Databricks Workspace file system (only in DBFS-disabled workspace)
/... (other than above) Legacy DBFS (deprecated)

Examples:

fs.ls("/Volumes/my_catalog/my_schema/my_volume/path")  # Access Unity Catalog Volume files
fs.ls("/Workspace/Users/user-a/path")  # Access workspace files (only in DBFS-disabled workspace)
fs.ls("/data/path")  # Access legacy DBFS files

For more details about dbfs:/ and POSIX path support in Databricks, see the official documentation.


Authentication

fsspec-databricks uses Databricks Unified Authentication provided by Databricks Python SDK.

You can find information about supported authentication parameters and environment variables in the Databricks Python SDK documentation.

Default authentication

If Databricks Unified Authentication is configured, fsspec-databricks will pick up credentials from the default profile. For more, see the above Databricks SDK docs.

from fsspec_databricks import DatabricksFileSystem

fs = DatabricksFileSystem()

with fs.open("dbfs:/Volumes/...") as f:
    ...

Via constructor parameters

You can programmatically configure authentication by passing parameters to DatabricksFileSystem constructor.

# Authentication with PAT
fs = DatabricksFileSystem(host=host_url, token=access_token)

# Use different profile
fs = DatabricksFileSystem(profile="production")

Via environment variables

Or, you can configure authentication via environment variables.

# Shell
export DATABRICKS_CONFIG_PROFILE=production
# Then in Python
fs = DatabricksFileSystem()  # will use the "production" profile

By fsspec configuration

You can use the fsspec's configuration model to configure and persist authentication parameters.

With WorkspaceClient

You can create DatabricksFileSystem by explicitly setting Databricks SDK's WorkspaceClient object. The created DatabricksFileSystem instance will use the authentication configured in the provided WorkspaceClient object.

from databricks.sdk import WorkspaceClient

client = WorkspaceClient(...)
...

fs = DatabricksFileSystem(client=client)

Note: a DatabricksFileSystem created with a WorkspaceClient will generally not be serializable, because WorkspaceClient instances are not serializable. Consider using other configuration methods if you need serializable filesystem objects.


Configuration options

In addition to the authentication parameters, fsspec-databricks supports the following configuration options.

Parameter name Description Default
config An optional pre-configured Databricks SDK Config object. If provided, it will be used for authentication. None
client An optional pre-configured Databricks SDK WorkspaceClient object. If provided, it will be used for accessing the Databricks Workspace API. None
use_local_fs_in_workspace Access files from the local file system rather than the remote Databricks API when running within a Databricks workspace. True
verbose_debug_log Whether to enable verbose debug logging for file system operations. False

For backend-specific parameters and all other options, see USAGE.md.


Differences from the original DatabricksFileSystem in fsspec

fsspec provides its own implementation of DatabricksFileSystem (fsspec.implementations.DatabricksFileSystem).

The main difference between DatabricksFileSystem in fsspec-databricks and the original one in fsspec is that the original one is for legacy DBFS (Databricks File System), which Databricks has already deprecated.

Databricks currently supports workspace files and Unity Catalog volumes in addition to the legacy DBFS, and it continues to use the dbfs:/ URL scheme for both legacy DBFS and the other file systems (documentation).

fsspec-databricks primarily aims to support new file systems (workspace files and Unity Catalog volumes) and enable seamless access to them using the same dbfs:/ URL scheme supported in Databricks workspaces.


Limitations

The following features are not yet implemented or have not been tested yet.

  • Compatibility with Databricks on AWS (not tested)
  • Legacy DBFS support (not tested)

We are actively developing and testing the library, and we welcome contributions and feedback from the community.


License

Apache License 2.0. See LICENSE for more details.

Metadata

Release files for fsspec-databricks 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fsspec-databricks 0.1.10
File Size Uploaded
fsspec_databricks-0.1.10.tar.gz 59.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fsspec-databricks 0.1.10
File Interpreter ABI Platform
fsspec_databricks-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 100.7 kB

Release files / fsspec_databricks-0.1.10.tar.gz

Download URL fsspec_databricks-0.1.10.tar.gz
Size 59.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2775b459736f05840c7c292b767e39c95d271f761fd55ea9b29477a635c0bfa
BLAKE2b-256 checksum
How to use checksums
17a4aceb571d110dc99091afb825a69177a1b0e95724e53aaa713210b6aba976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fsspec_databricks-0.1.10-py3-none-any.whl

Download URL fsspec_databricks-0.1.10-py3-none-any.whl
Size 40.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79829f86407f8875b0eec71f49c4c3f55f9c43f5025b651565281d44fc33c736
BLAKE2b-256 checksum
How to use checksums
8f4d4631541db170918ec2f3929fc43a2d4d78bff7726b90bde8bcd3e03a774b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page