Sub topic 5
Controlling who can use and manage a warehouse
This chapter assumes you can already create a SQL warehouse and run a query in the SQL editor. It also assumes you know what a Databricks workspace group is. It covers the permission levels on a warehouse, how those differ from data permissions, how to grant them in the UI and through the API, and the mistakes that usually show up first.
Two separate layers of access
Running a query involves two independent permission checks.
- Compute access. Can this user start and run statements on this warehouse? Access control lists (ACLs) on the warehouse decide this.
- Data access. Can this user read the tables the query touches? Unity Catalog privileges decide this.
A user needs both. Granting CAN USE on a warehouse gives no access to data. Granting SELECT on a table gives no way to run a query unless the user can reach some warehouse.
Keeping the layers apart lets you say "the finance group may use the finance warehouse" and "the finance group may read the ledger schema" as two separate decisions. You can then change either one without touching the other.
Warehouse permission levels
A warehouse has five permission levels. Each one includes the abilities of the levels above it in the table.
| Level | API name | What it allows |
|---|---|---|
| Can view | `CAN_VIEW` | See that the warehouse exists and read its basic details. It cannot run queries. |
| Can monitor | `CAN_MONITOR` | Everything in Can view, plus the monitoring tab and its query activity for that warehouse. |
| Can use | `CAN_USE` | Everything in Can monitor, plus run queries on the warehouse. A stopped warehouse starts automatically when a query arrives. |
| Can manage | `CAN_MANAGE` | Everything in Can use, plus edit settings (size, scaling, auto stop), start and stop it, delete it, and change its permissions. |
| Is owner | `IS_OWNER` | Everything in Can manage. The owner is usually the creator. |
Check the exact wording against your workspace's UI, because Databricks adjusts labels over time. The pattern holds: view, then monitor, then use, then manage.
Workspace admins can manage every warehouse in the workspace regardless of the ACL. Do not rely on warehouse ACLs to hide a warehouse from admins.
Choosing a level
- Give analysts
CAN USE. They can run queries and nothing else. - Give a platform or FinOps team
CAN MONITORon production warehouses if they need to watch load and spend without being able to change anything. - Give
CAN MANAGEto the small group that tunes size and scaling. - Give stakeholders who only read dashboards no warehouse permission at all. Dashboards usually run with a credential you choose when you publish them, covered in the dashboards chapter.
Granting access in the UI
- Open SQL Warehouses in the sidebar.
- Select the warehouse name to open its details.
- Select Permissions.
- Choose a user, group, or service principal, pick a level, and select Add.
Always choose groups when you can. A group named analysts that holds CAN USE on three warehouses is one membership change when someone joins, instead of a grant on each warehouse.
Granting access through the Permissions API
The Permissions API lets you keep warehouse ACLs in version-controlled scripts. This call gives a group CAN_USE without disturbing existing entries.
curl -X PATCH "$DATABRICKS_HOST/api/2.0/permissions/warehouses/$WAREHOUSE_ID" \
-H "Authorization: Bearer $DATABRICKS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"access_control_list": [
{
"group_name": "analysts",
"permission_level": "CAN_USE"
}
]
}'PATCH adds or updates the listed entries. PUT replaces the whole access control list, which removes every entry you leave out. Read the current list first with a GET to the same path before you use PUT.
curl -X GET "$DATABRICKS_HOST/api/2.0/permissions/warehouses/$WAREHOUSE_ID" \
-H "Authorization: Bearer $DATABRICKS_TOKEN"The response lists each principal with its direct and inherited levels. Inherited entries come from group membership, so a user can appear to have access that you never granted to them by name.
Data permissions: the other half
Warehouse access does not open any data. Grant the data privileges in Unity Catalog. The following example uses a hypothetical main.sales schema. You need to own these objects or hold MANAGE on them to run the grants.
GRANT USE CATALOG ON CATALOG main TO `analysts`;
GRANT USE SCHEMA ON SCHEMA main.sales TO `analysts`;
GRANT SELECT ON TABLE main.sales.orders TO `analysts`;
SHOW GRANTS ON TABLE main.sales.orders;A user needs all three. SELECT on the table does nothing without USE CATALOG and USE SCHEMA on its parents. A missing parent privilege is a common cause of "table not found" errors, since users without access to a parent cannot see the table at all.
Because the check runs per user, two people can run the same query on the same warehouse and get different outcomes. One succeeds. The other gets a permission error, or sees fewer rows if row filters or column masks apply.
Permissions on queries
Saved queries have their own ACL, separate from warehouse and data permissions. The levels are roughly:
CAN VIEW: read the query text and results.CAN RUN: run the query.CAN EDIT: change the query text.CAN MANAGE: change permissions and delete.
The query ACL controls who can open and edit the saved text. It does not give anyone warehouse or data access. Sharing a query with a colleague who has no CAN USE on any warehouse lets them read the SQL, but they cannot run it. The saved queries chapter covers sharing and organizing in more detail.
Workspace-level entitlements
Users also need the Databricks SQL access entitlement to see the SQL editor and warehouses at all. Admins can grant it per user or per group. Creating a warehouse takes more than CAN USE. It needs an admin or a user with the cluster-creation entitlement that your workspace admin has set up. If someone can run queries but the Create SQL warehouse button is missing, this entitlement is the first thing to check.
Common errors and how to read them
| Symptom | Likely cause | Fix |
|---|---|---|
| Warehouse does not appear in the editor's compute picker | No ACL entry reaches the user, or the user lacks Databricks SQL access | Add the user's group at `CAN USE`, and check the entitlement |
| Warehouse is listed but the query will not run | The user has only `CAN VIEW` or `CAN MONITOR` | Raise to `CAN USE` |
| Query runs but fails with insufficient privileges on a table | Missing `USE CATALOG`, `USE SCHEMA`, or `SELECT` | Grant the missing privilege in Unity Catalog |
| Colleague can open a shared query but not run it | Query ACL is fine, warehouse ACL is missing | Grant `CAN USE` on a warehouse |
| `PUT` removed everyone's access | `PUT` replaces the full list | Restore from your earlier `GET`, and use `PATCH` for additions |
| Unexpected cost on a large warehouse | Many users hold `CAN USE` on a large warehouse, and each query can start it | Point most users to a smaller warehouse and limit `CAN USE` on the large one |
A reasonable starting layout
For a team of analysts and a small platform group:
- Create groups
analystsandwarehouse-admins. - Give
analystsCAN USEon the shared analytics warehouse. - Give
warehouse-adminsCAN MANAGEon every warehouse. - Grant data privileges in Unity Catalog to
analystsat the schema level, not per table, where policy allows. - Review the ACL periodically with
GETon the Permissions API and remove stale entries.
Treat the owner as an accountability marker. If the owner leaves the company, an admin should reassign ownership so the warehouse does not end up with an unmanaged owner.
Exercise
A new analyst, Priya, is in the analysts group. That group has CAN USE on warehouse wh-shared. Priya opens the SQL editor, selects wh-shared, and runs SELECT * FROM main.sales.orders. She gets an insufficient privileges error. Which layer is failing, and which three Unity Catalog privileges must be present for the query to work?
Show answer
The data layer is failing. Warehouse access is fine, because she could select the warehouse and submit the query. The group needs USE CATALOG on main, USE SCHEMA on main.sales, and SELECT on main.sales.orders. A missing parent privilege can also make the table appear not to exist for her.
Exercise
You want to add the group finance-leads to a warehouse's ACL without disturbing any existing entries. Should you call the Permissions API with PUT or PATCH, and what is the risk of choosing the other one?
Show answer
Use PATCH, which adds or updates only the entries you list. PUT replaces the entire access control list, so every entry you leave out is removed, and the existing users and groups lose access.
Exercise
The platform team needs to watch query activity on a production warehouse but must not be able to change its size or run queries on it. Which permission level fits best?
Show answer
CAN MONITOR. It allows viewing the warehouse and its monitoring information. CAN USE would add the ability to run queries, and CAN MANAGE would add the ability to edit settings.