Sub topic 1
How Unity Catalog governs data and AI assets
Unity Catalog is the governance layer for Databricks. It keeps one set of rules for who can see and change data, and it applies those rules the same way in every workspace that uses it. This chapter gives the working model. Later chapters cover each part in detail.
Prerequisites
This chapter assumes you have:
- Basic SQL, including SELECT and CREATE statements.
- Familiarity with the Databricks workspace and either notebooks or the SQL editor.
- A general idea of users, groups and role-based access control.
You don't need administrator rights to read this chapter. To run the SQL examples, you need an account that can grant privileges on the objects involved. That means you must own them or be an administrator.
What problem Unity Catalog solves
Before Unity Catalog, each Databricks workspace kept its own table definitions and its own access rules. Two workspaces could hold copies of the same table with different permissions. Access to files in cloud storage was often controlled by credentials attached to compute, so anyone who could use that compute could read everything those credentials reached.
Unity Catalog moves these decisions into one account-level service. It provides four things:
- A central place to define access. You grant privileges once, and they apply in every workspace attached to the same metastore.
- A single naming scheme. Every governed object is addressed the same way, from any workspace.
- Fine-grained control. You can restrict access to a table, to rows within it, or to individual columns.
- A record of activity. Access events are logged so you can review who did what and when.
The word "assets" in the title covers more than tables. Unity Catalog also governs volumes (governed storage for files), functions, registered machine learning models, and the connections and storage locations that reach outside Databricks.
The working model in four ideas
1. Objects live in a hierarchy
Unity Catalog organizes assets in a tree. The top is the metastore, the container for all metadata and permissions in a region. Below it are catalogs, then schemas, and then the objects that hold or describe data, such as tables, views, volumes, functions and models.
You refer to a table with a three-level name: catalog.schema.table. For example, main.sales.orders is the orders table in the sales schema of the main catalog.
Each object in this tree is a securable object, which means you can grant privileges on it. The next chapter covers the hierarchy in full.
2. Principals receive privileges
A principal is an identity that can be given access: a user, a service principal (an identity for automation), or a group. A privilege is a specific permission, such as SELECT to read a table. You give a privilege to a principal on a securable object with GRANT.
Granting to groups instead of individual users keeps the model manageable. When someone changes roles, you change their group membership and leave the grants alone.
3. Access is denied unless granted
Unity Catalog follows a default-deny rule. A principal has no access to an object until a privilege is granted, either directly or through inheritance from a parent object. There is no explicit "deny" statement. Privileges only add access, so the effective access of a principal is the union of everything granted to it, to its groups, and to the parents of the object.
Inheritance means a privilege on a catalog or schema also applies to the objects inside it. A single grant on a schema can therefore cover many tables, including tables created later.
4. Every request is checked
When a query runs, Unity Catalog checks whether the principal holds the privileges needed for each object the query touches. The check covers the whole path, not only the final table. Each request is also written to the audit log.
A request, step by step
The diagram shows what happens when a user runs a query against a table.
Two details in this flow cause most beginner mistakes. First, SELECT on a table is not enough on its own. The user also needs USE CATALOG on the parent catalog and USE SCHEMA on the parent schema. Second, row filters and column masks run after the privilege check. They change what the user sees, but they cannot give access that was never granted.
A first example
This SQL gives the group data-analysts read access to one table. It grants the two parent privileges and then SELECT.
GRANT USE CATALOG ON CATALOG main TO `data-analysts`;
GRANT USE SCHEMA ON SCHEMA main.sales TO `data-analysts`;
GRANT SELECT ON TABLE main.sales.orders TO `data-analysts`;Members of data-analysts can now run SELECT * FROM main.sales.orders. They cannot read other tables in main.sales, because no privilege on those tables was granted. They also cannot change the table, because SELECT allows reading only.
To check what you have done, list the privileges on the table:
SHOW GRANTS ON TABLE main.sales.orders;The pieces of the governance model
The rest of the tutorial builds on this map. Each row names a feature, what it controls, and where it fits.
| Feature | What it controls | Level of detail |
|---|---|---|
| Privileges and `GRANT` | Which principals can read, change or create objects | Per object, with inheritance |
| Ownership | Who can manage an object and grant access to it | Per object |
| Administrative roles | Who manages the account, workspaces and metastore | Account or metastore wide |
| Storage credentials and external locations | Access to paths in cloud storage | Per storage path |
| Dynamic views, row filters, column masks | Which rows and column values a user sees | Row and column |
| Workspace bindings | Which workspaces can use a catalog | Per catalog |
| Compute access modes | Whether a cluster can enforce these rules | Per compute resource |
| Audit logs | A record of who accessed what | Account wide |
Common errors and misunderstandings
- Granting
SELECTbut not the parent privileges. The user gets a permission error even though the table grant looks correct. Check forUSE CATALOGandUSE SCHEMA. - Assuming workspace permissions control data. Being able to open a workspace or attach to a cluster does not give access to data. Data access comes from Unity Catalog privileges.
- Expecting Unity Catalog to govern every table you see. The legacy
hive_metastorecatalog that appears in some workspaces is not governed by Unity Catalog privileges in the same way. Check which catalog a table is in before you reason about its permissions. - Using compute that cannot enforce the rules. Permissions only protect data when the compute enforces them. Compute access modes are covered in a later chapter.
- Granting to individual users. Direct grants are hard to review and easy to forget. Use groups.
- Looking for a deny rule. No such rule exists. To remove access, revoke the grant that provides it. If the access comes from a group or a parent object, revoke it there.
How this connects to the rest of the tutorial
The chapters that follow take the four ideas above in turn. The next chapter describes the hierarchy in detail. After it come principals and privilege types, then GRANT, REVOKE and inheritance. Later chapters cover ownership, administrative roles, storage access, row-level and column-level controls, workspace bindings, compute, auditing and the design of a least-privilege model.
Exercise
A user in the group data-analysts has SELECT on main.sales.orders but gets a permission error when querying it. Which two privileges should you check first, and on which objects?
Show answer
Check that the group holds USE CATALOG on the catalog main and USE SCHEMA on the schema main.sales. Querying a table requires privileges on the whole path, so SELECT on the table alone is not enough. You can confirm what is missing with SHOW GRANTS on the catalog and the schema.
Exercise
You revoke SELECT on a table from one user, but that user can still read it. Name two likely causes.
Show answer
The user may still receive SELECT through membership in a group that was granted it, or through a SELECT grant on the parent schema or catalog that the table inherits. Privileges are additive and there is no explicit deny, so you must revoke the grant at the level where it was made.