/databricks-skills:cookbook-volumesfrom databricks-skills
Upload and download files from Unity Catalog Volumes in Databricks Apps using the Databricks SDK. Provides code examples for Dash, Streamlit, Reflex, and FastAPI.
Ships in databricks-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Upload and download files from Unity Catalog Volumes using the Databricks SDK. Unlike notebooks, Databricks Apps cannot mount volumes directly -- files must be uploaded/downloaded via the SDK.
import io
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
with open("local_file.csv", "rb") as f:
file_bytes = f.read()
binary_data = io.BytesIO(file_bytes)
volume_file_path = "/Volumes/catalog/schema/volume_name/local_file.csv"
w.files.upload(volume_file_path, binary_data, overwrite=True)
import io
import streamlit as st
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
uploaded_file = st.file_uploader("Select file")
volume_path = st.text_input(
"Volume path (catalog.schema.volume):",
placeholder="main.marketing.raw_files",
)
if st.button("Upload") and uploaded_file and volume_path:
binary_data = io.BytesIO(uploaded_file.read())
parts = volume_path.strip().split(".")
path = f"/Volumes/{parts[0]}/{parts[1]}/{parts[2]}/{uploaded_file.name}"
w.files.upload(path, binary_data, overwrite=True)
st.success(f"Uploaded to {path}")
import io
import reflex as rx
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
class VolumeUploadState(rx.State):
volume_path: str = ""
async def handle_upload(self, files: list[rx.UploadFile]):
for file in files:
data = await file.read()
parts = self.volume_path.strip().split(".")
path = f"/Volumes/{parts[0]}/{parts[1]}/{parts[2]}/{file.filename}"
w.files.upload(path, io.BytesIO(data), overwrite=True)
FastAPI uses OAuth client credentials to access the Files API for streaming:
from fastapi import APIRouter
from fastapi.responses import StreamingResponse
from databricks.sdk import WorkspaceClient
router = APIRouter()
w = WorkspaceClient()
@router.get("/files/{file_path:path}")
async def stream_file(file_path: str):
response = w.files.download(f"/Volumes/{file_path}")
return StreamingResponse(response.contents, media_type="application/octet-stream")
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
file_path = "/Volumes/catalog/schema/volume_name/file.csv"
response = w.files.download(file_path)
file_data = response.contents.read()
For Streamlit, use st.download_button to offer the file to the user:
import streamlit as st
st.download_button(
label="Download file",
data=file_data,
file_name="file.csv",
)
Volumes use the path format: /Volumes/<catalog>/<schema>/<volume_name>/<file_path>
From a three-level name like main.marketing.raw_files:
parts = "main.marketing.raw_files".split(".")
path = f"/Volumes/{parts[0]}/{parts[1]}/{parts[2]}/my_file.csv"
# -> /Volumes/main/marketing/raw_files/my_file.csv
| Action | Permissions |
|---|---|
| Upload | USE CATALOG, USE SCHEMA, READ VOLUME, WRITE VOLUME |
| Download | USE CATALOG, USE SCHEMA, READ VOLUME |
See Volume operation privileges.
databricks-sdk
Plus your framework package (dash, streamlit, reflex, or fastapi).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
databricks, unity-catalog, file-upload, file-download, volumes
12 skills in this plugin
/cookbook-aimlInvoke ML models, run vector search, and connect to MCP servers from Databricks Apps. Use when the user wants to call a model serving endpoint, query a vector search index, use LLMs/embeddings, or connect to an MCP server in Dash, Streamlit, Reflex, or FastAPI./cookbook-authenticationImplement authentication in Databricks Apps: get current user info, on-behalf-of-user (OBO) auth, service principal auth, and OAuth patterns. Use when the user asks about auth, user tokens, service principals, OAuth, or OBO in Dash, Streamlit, Reflex, or FastAPI./cookbook-biEmbed AI/BI dashboards and integrate Genie Spaces into Databricks Apps. Use when the user wants to embed a Databricks dashboard or build a chat interface with the Genie Conversations API in Dash, Streamlit, or Reflex.npx claudepluginhub databricks-solutions/databricks-apps-cookbook --plugin databricks-skillsOther plugins' skills for the same job