Sub topic 2
Governing Models, Data, and Indexes with Unity Catalog
This chapter assumes you can work in Databricks notebooks, know what a Delta table is, and have read the platform overview. Here you will see how Unity Catalog applies one permission model to the data, indexes, and models in a generative AI application.
Why governance comes first
A generative AI application reads documents, searches an index, calls a model, and may serve an agent to other people. Each step touches an asset that someone must be allowed to use. Unity Catalog is the Databricks governance layer. It stores these assets under one naming scheme and one permission model, so you do not manage a separate access system for each part.
The three-level namespace
Unity Catalog names every asset as catalog.schema.name. The examples in this tutorial use the catalog main and the schema genai.
| Asset | Example name | Role in the application |
|---|---|---|
| Delta table | `main.genai.docs_chunks` | Source text for retrieval |
| Vector Search index | `main.genai.docs_index` | Similarity search over the table |
| Registered model | `main.genai.support_agent` | Versioned agent that gets deployed |
Because the three assets share a schema, you can grant access to the whole schema or to individual objects.
Privileges you will use
Access is granted with SQL GRANT statements. Two privileges apply to nearly every asset. USE CATALOG and USE SCHEMA let a principal reach the containers. Without them, other grants have no effect. Beyond those, you grant object-level privileges such as SELECT on tables or EXECUTE on models.
GRANT USE CATALOG ON CATALOG main TO `genai-developers`;
GRANT USE SCHEMA ON SCHEMA main.genai TO `genai-developers`;
GRANT SELECT ON TABLE main.genai.docs_chunks TO `genai-developers`;
GRANT EXECUTE ON MODEL main.genai.support_agent TO `genai-developers`;Grant to groups rather than individual users. Membership changes then happen in one place.
Governing the index through its source table
A Delta Sync index is created from a source table, and it appears in Unity Catalog as its own object. The index holds copies of your text, so anyone who can query it can read that content. Keep this in mind when you choose what to index.
- Index only tables that every intended reader of the application may see.
- Put sensitive documents in a separate schema, and give them a separate index with narrower grants.
- Creating an index requires permission to create objects in the target schema, plus read access to the source table.
When you call create_delta_sync_index, the index_name argument takes the full three-part name. A name that omits the catalog or schema is a common cause of creation errors.
Registering models in Unity Catalog
MLflow can use Unity Catalog as its model registry. Set the registry URI before you register an agent.
import mlflow
mlflow.set_registry_uri("databricks-uc")Without this line, MLflow may target the older workspace registry, which lacks Unity Catalog's permissions, lineage, and three-level names. Registered models then get numbered versions. You grant EXECUTE on the model, and deployment later references a specific version. A later chapter covers that step.
Lineage and auditing
Unity Catalog records lineage, which shows how assets relate. For example, it can show which table feeds an index. It also writes audit logs of who accessed what. These records help you answer questions such as which applications break if you change a table, and who queried a restricted index.
Common errors
- Permission denied on a table you can see. You likely have
SELECTbut lackUSE SCHEMAon its schema. - Index creation fails on the source table. Check that Change Data Feed is enabled on the table and that you have read access to it.
- Model registers in the wrong place. The registry URI was not set to
databricks-uc, or the name lacks the catalog and schema.
Exercise
A teammate can run SELECT on main.genai.docs_chunks but cannot query main.genai.docs_index. Name two checks you would make.
Show answer
First, confirm the teammate has USE CATALOG and USE SCHEMA on the containers of the index. Second, check that the teammate has been granted access to the index object itself, since the index has its own permissions separate from its source table.