Sub topic 3
What a Unity Catalog volume is
This chapter assumes you know the Databricks workspace and notebooks, can read basic Python and SQL, and know what a catalog, schema and table are. It builds on the previous chapter's namespace and leads into path building and access control.
The problem volumes solve
Tables hold rows and columns. Many workloads also need files that are not tables: CSV drops from a vendor, images, PDFs, JSON logs, model artifacts, or ZIP archives. Before Unity Catalog, these files usually went to DBFS or to cloud storage paths that Databricks governance could not see. Access rules for them were scattered across cloud IAM policies and workspace settings.
A volume is a Unity Catalog object that holds files and is governed like a table. It is a logical storage location inside a cloud storage path. You grant privileges on the volume, and Unity Catalog enforces them and records access in audit logs.
Where a volume sits
A volume is the third-level object in a schema, next to tables, views and functions. Its full name is catalog.schema.volume.
A volume can contain files in any format and any directory structure. Unity Catalog does not interpret the contents. It controls who can read or write the files, not what they contain.
Creating a volume and granting access
Creating a volume needs the CREATE VOLUME privilege on the schema. You also need USE CATALOG and USE SCHEMA on the parents.
CREATE VOLUME IF NOT EXISTS main.default.landing
COMMENT 'Raw files before ingestion';
GRANT READ VOLUME, WRITE VOLUME ON VOLUME main.default.landing TO `data-engineers`;This statement creates a managed volume, where Databricks chooses the storage location. The GRANT gives the group data-engineers permission to read and write files. Each grantee also needs USE CATALOG on the catalog and USE SCHEMA on the schema, or the grant has no effect in practice.
Using the files
Once a volume exists, its files appear under a path that starts with /Volumes. This notebook code copies a local file into the volume and lists the result:
src = "file:/tmp/sales.csv"
dst = "/Volumes/main/default/landing/sales.csv"
dbutils.fs.cp(src, dst)
display(dbutils.fs.ls("/Volumes/main/default/landing/"))The file:/ prefix tells dbutils the source is on the driver's local disk. The destination needs no prefix. The next chapter covers the path format in detail.
How volumes differ from tables and DBFS
| Feature | Volume | Table | DBFS root |
|---|---|---|---|
| Holds | Any files | Rows and columns | Any files |
| Governed by Unity Catalog | Yes | Yes | No |
| Addressed by | `/Volumes/...` path | `catalog.schema.table` | `dbfs:/...` path |
| Recommended for new work | Yes, for files | Yes, for tabular data | No, legacy |
Common mistakes
- Treating a volume as a table. Files in a volume do not become queryable tables on their own. Load them with Spark or
read_files, then write the result to a table. - Granting only
READ VOLUME, then expecting uploads to work. Writing needsWRITE VOLUME. - Forgetting the parent privileges
USE CATALOGandUSE SCHEMA. - Using an older compute runtime. Volumes need a Unity Catalog-enabled compute resource, and Databricks Runtime 13.3 LTS or above.
Exercise
A user has READ VOLUME on main.default.landing but gets a permission error when listing the volume. Which other privileges should you check?
Show answer
Check USE CATALOG on main and USE SCHEMA on main.default. Without them, the user cannot reach the volume even with READ VOLUME. Also confirm the compute resource is Unity Catalog-enabled.