Sub topic 13
Compute access modes and permission enforcement
This chapter assumes you know how to grant privileges with SQL, how the catalog, schema and table hierarchy works, and how row filters and column masks are attached to tables. Here you will see why those controls depend on the compute you run queries on.
Why compute matters
Unity Catalog stores the rules, but the compute that runs your query has to enforce them. If a cluster cannot guarantee that users only see data they are allowed to see, Unity Catalog will not hand it governed data, or it will restrict what the cluster can do.
The setting that decides this on a classic cluster is the access mode.
The access modes
| Access mode | Users | Languages | Unity Catalog enforcement |
|---|---|---|---|
| Standard (shared) | Many users on one cluster | SQL, Python, Scala (support varies by runtime) | Enforced. User code is isolated from other users. |
| Dedicated (single user) | One user or one group | SQL, Python, Scala, R | Enforced for the assigned identity. Fine-grained controls need extra handling. |
| No isolation shared | Many users | Any | Not supported for Unity Catalog. |
Names and exact features change between Databricks Runtime versions. Check the current documentation for your runtime before you design around a specific capability.
Standard access mode
Standard mode lets several users share a cluster. Each user's code runs in isolation, so one user cannot read another user's credentials or bypass the permission checks. Because enforcement happens inside the engine, row filters, column masks and dynamic views apply to every query.
Dedicated access mode
Dedicated mode assigns the cluster to one user or one group. Queries run with the identity of the assigned principal. This mode gives you full language support, including libraries and workloads that need low-level access to the machine.
The catch is that the user code can run with broad access on the machine. For tables with row filters, column masks, or dynamic views, the cluster cannot always apply those controls directly. On supported runtimes, Databricks handles this by running the filtering step on separate serverless compute, which can add cost and latency. On older runtimes, the query may fail.
Serverless compute and SQL warehouses
SQL warehouses and serverless compute are built for Unity Catalog and enforce permissions in the same way as standard mode. If you want the fewest surprises with row filters, column masks and dynamic views, these are the simplest choice.
Checking what a cluster runs as
When a query returns less data than you expect, confirm which identity runs it and which groups that identity belongs to. The functions used in your filters and masks report this directly.
SELECT
current_user() AS who,
is_account_group_member('pii_readers') AS can_see_email,
is_account_group_member('admins') AS is_admin;On a dedicated cluster assigned to a group, the identity is tied to that group's permissions. Two people on that cluster can see different results in a shared notebook if the cluster is not assigned the way you assumed.
Common errors
- Table not visible or query rejected on a cluster. The cluster is in no isolation shared mode, or the runtime is too old. Switch to standard or dedicated mode on a current runtime.
- A masked column shows real values to the wrong person. Check which identity the query runs as. A dedicated cluster uses the assigned principal, not necessarily the person typing.
- A query on a filtered table fails on a dedicated cluster. The runtime does not support the filtering step. Move to standard mode, a SQL warehouse, or a newer runtime.
- Permissions look correct but access is denied. The principal may be missing
USE CATALOGorUSE SCHEMAon a parent object. UseSHOW GRANTSat each level.
Exercise
A team runs notebooks on a dedicated cluster assigned to the group analysts. The customers table has a column mask on email, and the mask shows real values only to pii_readers. One analyst is in analysts but not in pii_readers. What two things should you check to predict what that analyst sees?
Show answer
Check which identity the dedicated cluster runs queries as (here the analysts group assignment) and whether that identity is a member of pii_readers, using is_account_group_member. Also check whether the runtime supports applying masks on dedicated compute, since otherwise the query may fail or use separate filtering compute.