Sub topic 1
Unity Catalog in brief: securables, privileges, and the metastore
Lineage and audit data in Unity Catalog are both governed by the same permission model as ordinary tables. To read them, grant access to them, and interpret what they show, you first need a clear picture of how Unity Catalog organizes objects and decides who may use them. This chapter covers that model: the metastore, the securable object hierarchy, privileges and inheritance, ownership, and where the system catalog fits. Later chapters rely on these ideas.
Prerequisites
This chapter assumes you already have the following:
- Basic SQL:
SELECT,WHERE, and joins. - Familiarity with Databricks workspaces, notebooks, and SQL warehouses.
- Awareness of the three-level namespace,
catalog.schema.table. - A basic idea of what
GRANTandSELECTpermissions mean.
To run the examples you need a workspace attached to a Unity Catalog metastore, and a catalog where you can create objects or at least receive grants. The examples use a catalog named main and a group named analysts. Replace these with names from your own environment.
The metastore: the top-level container
The metastore is the top-level container for Unity Catalog metadata. It stores the definitions of catalogs, schemas, tables, and other objects, plus the permissions on them. It does not hold the table data itself. Data stays in cloud object storage, and the metastore records where.
Three facts about metastores matter in practice:
- You normally have one metastore per cloud region in an account. Many workspaces in that region can attach to the same metastore.
- Because the metastore is shared across attached workspaces, a grant made in one workspace applies in all of them. Governance is defined once, not per workspace.
- Lineage and audit data are collected for activity in the metastore's workspaces, so the metastore is the unit that gives you a single governed view.
A metastore admin is a role with broad control over the metastore. Treat it as a role for a small number of trusted people or groups. Day-to-day grants should be made by object owners, not by metastore admins.
The three-level namespace and the object hierarchy
Every table is addressed as catalog.schema.table. This is a hierarchy of containers:
- A catalog is the first level. It usually maps to an environment, a business unit, or a domain.
- A schema (also called a database) sits inside a catalog and groups related objects.
- Tables, views, volumes, functions, and registered ML models sit inside a schema.
Some securables sit outside this tree but are attached to the metastore. These include storage credentials, external locations, connections to external systems, and Delta Sharing objects such as shares and recipients.
A securable is any object that you can grant privileges on. Each item in the diagram is a securable. The hierarchy matters because privileges flow down it.
Principals
A principal is an identity that can receive privileges. There are three kinds:
- Users, identified by email address.
- Groups, which collect users and other groups.
- Service principals, which are identities for automation such as jobs and CI pipelines.
Principals are defined at the account level, so the same identity is recognized in every attached workspace. Grant to groups rather than individual users. Group grants are easier to review, and they survive staff changes. This also makes the access reviews described later in the tutorial much simpler, because you review group membership instead of hundreds of individual grants.
Privileges
A privilege is a permission on a securable. The common ones are:
| Privilege | Applies to | What it allows |
|---|---|---|
| `USE CATALOG` | Catalog | Look inside the catalog. Required to reach anything in it. |
| `USE SCHEMA` | Schema | Look inside the schema. Required to reach anything in it. |
| `SELECT` | Table, view | Read data. |
| `MODIFY` | Table | Insert, update, delete, and merge data. |
| `CREATE TABLE` | Schema | Create tables and views in the schema. |
| `CREATE SCHEMA` | Catalog | Create schemas in the catalog. |
| `EXECUTE` | Function, model | Call the function or use the model. |
| `READ VOLUME` | Volume | Read files in the volume. |
| `ALL PRIVILEGES` | Any | Every privilege that applies to the object. |
The most common mistake for newcomers is granting SELECT on a table and nothing else. Reading a table requires three things together: USE CATALOG on its catalog, USE SCHEMA on its schema, and SELECT on the table. Without the first two, the user gets a permission error even though the table-level grant exists.
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`;Backticks around the group name are needed when it contains characters such as hyphens or spaces. They are harmless otherwise.
Inheritance
Privileges granted on a container are inherited by the objects inside it, including objects created later. Granting SELECT on a schema gives read access to every current and future table and view in that schema:
GRANT SELECT ON SCHEMA main.sales TO `analysts`;Granting it on a catalog extends the same access to every schema in that catalog. Inheritance is convenient, and it is also how access spreads further than intended. A broad grant on a catalog is easy to write and hard to notice later. Prefer grants at the narrowest level that works, and check inherited access when you review who can read what.
Ownership
Every securable has an owner, usually the principal that created it. An owner holds all privileges on the object and can grant privileges on it to others. Ownership can be transferred. Owners are worth auditing: a person who owns a table can change who reads it, and the change is recorded as an event in the audit log.
Views and filtering
A view is a securable of its own. By default a view reads its underlying tables with the owner's privileges. A user needs SELECT on the view, but not on the tables beneath it. This lets you expose a restricted slice of a table. Row filters and column masks are the finer-grained tools. They hide rows or mask values for users who should not see them. Lineage records that a view read from a table even when the viewer has no access to that table, which is one reason lineage visibility has its own rules, covered later in this tutorial.
Inspecting and revoking grants
Use SHOW GRANTS to see which privileges exist on an object. Listing a principal limits the output to that principal's grants:
SHOW GRANTS ON TABLE main.sales.orders;
SHOW GRANTS `analysts` ON SCHEMA main.sales;Remove a privilege with REVOKE:
REVOKE SELECT ON SCHEMA main.sales FROM `analysts`;Revoking on a container removes the inherited access. It does not remove grants made directly on child objects. After a revoke, check the children too, because a direct grant on a table survives a revoke on its schema.
The system catalog
Each metastore includes a catalog named system. It holds system tables, which are read-only tables that Databricks maintains and fills with operational and governance data. The system.access schema is the one that matters for this tutorial. It contains:
table_lineageandcolumn_lineage, which record how data moves between tables and columns.audit, which records events across the account.
Ordinary users cannot read these tables by default. Access follows the same rules as any other securable, so you grant USE CATALOG, USE SCHEMA, and SELECT:
GRANT USE CATALOG ON CATALOG system TO `data-governance`;
GRANT USE SCHEMA ON SCHEMA system.access TO `data-governance`;
GRANT SELECT ON TABLE system.access.table_lineage TO `data-governance`;
GRANT SELECT ON TABLE system.access.column_lineage TO `data-governance`;
GRANT SELECT ON TABLE system.access.audit TO `data-governance`;This grants exactly what a governance team needs and nothing more. Prefer table-level grants like these over a schema-wide SELECT, because a schema-level grant would also expose any table added to that schema later. The audit table in particular contains user email addresses and request details, so treat read access to it as sensitive.
Some system schemas must be enabled by an account admin before they appear in the metastore. If a table you expect is missing, check this first rather than assuming a permissions problem.
How this connects to lineage and audit
The permission model is the reason lineage and audit data exist in a useful form. Unity Catalog sees every request to a governed object, because every read, write, and grant passes through it. That position lets it record where data flows (lineage) and who did what (audit). It also explains the failure patterns you will meet later:
- A user cannot see part of a lineage graph because they lack privileges on some of the objects in it.
- A query on
system.access.auditfails because nobody granted the three required privileges on thesystemcatalog. - An audit event shows a denied request, because a principal tried to reach an object without the full chain of
USE CATALOG,USE SCHEMA, andSELECT.
Do not give broad groups `ALL PRIVILEGES` on a catalog just to unblock a permission error. Inheritance applies the grant to every current and future object below it. Find the missing privilege instead. It is usually `USE CATALOG` or `USE SCHEMA`.Summary of the working model
- One metastore per region holds the metadata and permissions for all attached workspaces.
- Objects form a hierarchy: metastore, catalog, schema, then tables, views, volumes, and functions.
- Privileges are granted to principals, preferably groups, and inherited down the hierarchy.
- Reading a table needs
USE CATALOG,USE SCHEMA, andSELECTtogether. - Owners can grant on their objects, so ownership is part of the access picture.
- The
systemcatalog exposes lineage and audit tables, readable only after explicit grants.
Exercise
A group named finance-analysts has SELECT on main.finance.ledger, but its members get a permission error when they query it. What is the most likely cause, and which statements fix it?
Show answer
The group is missing USE CATALOG on main and USE SCHEMA on main.finance. Reading a table needs all three privileges. Run GRANT USE CATALOG ON CATALOG main TO finance-analysts; and GRANT USE SCHEMA ON SCHEMA main.finance TO finance-analysts;. Then check the result with SHOW GRANTS finance-analysts ON SCHEMA main.finance;.
Exercise
You grant SELECT on the schema main.sales to analysts, then later revoke SELECT on main.sales from analysts. A member of analysts can still read main.sales.orders. Give one reason this can happen and how to confirm it.
Show answer
A direct grant of SELECT on the table main.sales.orders still exists. Revoking on the schema removes only the inherited access, not grants made directly on child objects. Confirm it with SHOW GRANTS ON TABLE main.sales.orders; and revoke the direct grant if it is not wanted. The user could also receive the access through another group they belong to.