Sub topic 11
How privileges are inherited
This chapter assumes you can run basic SQL in a Databricks notebook or the SQL editor. It also assumes you know the three-level namespace (catalog.schema.table) and have seen GRANT and REVOKE. Here you learn how a privilege granted on one object reaches the objects below it, and what you must still grant yourself.
The inheritance rule
Unity Catalog objects form a hierarchy: metastore, catalog, schema, then tables and other objects. A privilege granted on a container applies to the objects inside it. This includes objects that are created after the grant.
For example, SELECT on a schema gives read access to every table and view in that schema, now and later. SELECT on a catalog covers every schema in that catalog. Inheritance only flows downward. A grant on a table never affects its schema or catalog.
Two kinds of privilege
Reading a table needs more than SELECT. The user must also be able to reach the table through its parents. Two privileges handle this:
USE CATALOGon the catalog.USE SCHEMAon the schema.
These are access gates. They do not expose data on their own. SELECT on the table does that.
The table-level grants below show the minimum set for one table.
GRANT USE CATALOG ON CATALOG dev TO `data-analysts`;
GRANT USE SCHEMA ON SCHEMA dev.sales TO `data-analysts`;
GRANT SELECT ON TABLE dev.sales.orders TO `data-analysts`;Granting at a higher level
Granting at schema level is shorter and also covers tables created later.
GRANT SELECT ON SCHEMA dev.sales TO `data-analysts`;
SHOW GRANTS ON SCHEMA dev.sales;SHOW GRANTS lists only the grants made directly on that object. It does not list privileges the object inherits from its parents. To see what a user can do on a table, check the table, its schema, and its catalog.
Revoking works at the same level where you granted:
REVOKE SELECT ON SCHEMA dev.sales FROM `data-analysts`;Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| "Permission denied" on a table the user has `SELECT` on | Missing `USE CATALOG` or `USE SCHEMA` on a parent | Grant the missing `USE` privilege |
| User can still read after a table-level `REVOKE` | `SELECT` is inherited from the schema or catalog | Revoke at the parent level |
| New table is unreadable | Grant was on the table, not the schema | Grant at schema level for future tables |
| Group sees too much | Catalog-level grant is broader than intended | Move the grant down to the schema or table |
Choosing the grant level
Grant at the lowest level that matches the access you intend. A schema-level grant suits a team that should read everything in one subject area. A table-level grant suits a single sensitive table. A catalog-level grant suits a whole environment, such as read access to all of dev. Broad grants are easy to manage but easy to over-share, so prefer groups over individual users and review them with SHOW GRANTS.
Exercise
A group has USE CATALOG on dev and SELECT on the table dev.sales.orders, but queries on that table fail with a permission error. What is missing, and what command fixes it?
Show answer
The group lacks USE SCHEMA on the parent schema. Run GRANT USE SCHEMA ON SCHEMA dev.sales TO data-analysts; (using the group's name). Table-level SELECT only works when the user can reach the table through both parent objects.
Exercise
You granted SELECT on schema dev.sales to a group, then ran REVOKE SELECT ON TABLE dev.sales.orders FROM that group. Can the group still read orders? Why?
Show answer
Yes. The group still inherits SELECT from the schema grant, and the table-level REVOKE does not remove a privilege granted on the parent. Revoke SELECT on the schema instead, then grant it on the specific tables that should stay readable.