Sub topic 3
How Unity Catalog names and organizes models
This chapter explains where a registered model lives in Unity Catalog and how its name is built. It assumes you have read the previous chapters on logging a model and adding a signature. It also assumes you know that Unity Catalog organizes tables into catalogs and schemas. The chapter has no new model-training code. The goal is to make every later step, from registering to granting access to serving, easier to follow because you know what the name refers to.
The three-level namespace
Unity Catalog is the governance layer in Databricks. It identifies data and AI assets by a three-level name:
catalog.schema.objectTables, views, volumes, functions, and registered models all use this form. A registered model named main.default.iris_classifier therefore breaks down as follows.
| Part | Value | Meaning |
|---|---|---|
| Catalog | `main` | Top-level container, usually one per environment, team, or business domain |
| Schema | `default` | A grouping inside the catalog, also called a database |
| Model | `iris_classifier` | The registered model, which sits beside tables and functions in the schema |
Above the catalog sits the metastore. A metastore is the top-level Unity Catalog container for a region, and you do not name it in an object path. Every workspace attached to the same metastore sees the same catalogs, schemas, and models. A model registered from one workspace can be loaded from another one, provided the user has the privileges.
A model is a securable object
A securable object is anything you can grant privileges on. In Unity Catalog the registered model is a securable object of its own. This has three consequences.
- A model has an owner. By default the owner is the user or service principal that created it.
- A model has privileges that are separate from those on the tables it was trained on.
- A model inherits visibility rules from its parents. To reach a model, a principal needs access to the catalog and the schema first.
The next chapters cover the privileges in detail. For now, remember that the namespace is also the permission hierarchy. Granting a privilege on a catalog or schema can apply to every model below it.
Registered models, versions, and aliases
The three-level name identifies a registered model. A registered model is a named container. It does not hold model files directly. Each time you log a model with that registered_model_name, Unity Catalog creates a new model version inside the container.
- Registered model:
main.default.iris_classifier. The name is permanent, and so are its owner and its privileges. - Model version: an integer such as
1,2, or3, assigned automatically and never reused. A version points to a specific set of logged artifacts and the signature recorded with them. - Alias: a mutable, named pointer to one version, such as
champion. You can move an alias from version 1 to version 2 without changing any caller. One version can have several aliases, but one alias points to one version at a time.
Versions and aliases are the subject of a later chapter. The key point here is that the three-level name never contains a version. Where a version or alias appears, it is added after the name. The URI forms are models:/main.default.iris_classifier/2 for a version and models:/main.default.iris_classifier@champion for an alias.
Telling MLflow to use Unity Catalog
MLflow can talk to two different registries. The older workspace model registry has flat names such as iris_classifier and uses stages like Staging and Production. The Unity Catalog registry uses three-level names and aliases. MLflow picks the registry from the registry URI. You set it once per session:
import mlflow
mlflow.set_registry_uri("databricks-uc")If you skip this call, a name with dots is sent to the workspace registry. That registry does not accept it, and you get an error about the name format. Setting the URI is the first fix to try when a three-level name is rejected.
You can then ask Unity Catalog about a model by its full name:
import mlflow
from mlflow import MlflowClient
mlflow.set_registry_uri("databricks-uc")
client = MlflowClient()
model_name = "main.default.iris_classifier"
registered = client.get_registered_model(model_name)
print("Registered model:", registered.name)
for mv in client.search_model_versions(f"name = '{model_name}'"):
print("version", mv.version, "status", mv.status)search_model_versions is filtered by the full three-level name. Lookups need the full name. A bare iris_classifier does not resolve, because MLflow does not know which catalog and schema you mean.
Naming rules
Unity Catalog applies the same naming rules to every object name. The rules to keep in mind are these:
- A name is stored in lowercase.
Iris_Classifierandiris_classifierrefer to the same model. - A name cannot contain a period, a space, a forward slash, or control characters. The period is the separator, so it cannot appear inside a part.
- Each part must be present.
main..iris_classifierandiris_classifierare both invalid. - A name must be unique within its schema. The same model name can exist in two different schemas, and these are two different models.
In SQL, you can quote a name with backticks when it contains unusual characters. For model names that you also pass through MLflow and REST paths, plain lowercase letters, digits, and underscores are the practical choice. They need no quoting anywhere.
The helper below checks a name before you pass it to MLflow. This catches typos early, with a clearer message than the registry returns.
def split_model_name(full_name: str) -> tuple[str, str, str]:
"""Split 'catalog.schema.model' into its parts or raise ValueError."""
parts = full_name.split(".")
if len(parts) != 3 or not all(parts):
raise ValueError(
f"Expected 'catalog.schema.model', got {full_name!r}"
)
for part in parts:
if any(ch in part for ch in " /"):
raise ValueError(f"Invalid character in name part {part!r}")
catalog, schema, model = (p.lower() for p in parts)
return catalog, schema, model
print(split_model_name("main.default.Iris_Classifier"))
# ('main', 'default', 'iris_classifier')
try:
split_model_name("iris_classifier")
except ValueError as err:
print(err)The helper is a convenience, not a full copy of the service's validation. Unity Catalog remains the final authority on what it accepts.
Choosing where models live
The name is your first design decision, and renaming later is awkward. Because models are governed like tables, the layout you pick for tables is a good starting point. Three common patterns are listed below.
| Layout | Example | When it fits |
|---|---|---|
| One catalog per environment | `dev.fraud.model_a`, `prod.fraud.model_a` | Teams that promote models between environments and want separate permissions for each |
| One catalog per team or domain | `fraud.models.model_a` | Teams that want ownership to follow business domains |
| A shared `main` catalog | `main.default.model_a` | Experiments and tutorials, not production |
Many teams keep a dedicated schema for models, for example prod.fraud.models, so that grants on models do not also expose feature tables. This is a convention, not a requirement. Unity Catalog lets models and tables share a schema.
Separate catalogs for environments also affect promotion. You copy a model version from one registered model to another, for example from dev.fraud.model_a to prod.fraud.model_a, and the copy gets its own version number and its own permissions. Aliases such as champion mark which version is live within each environment.
Creating the containers
A model can only be registered in a catalog and schema that exist. You need the right privileges to create them, and the next chapters cover which ones. If you are allowed to create them, the SQL is short:
CREATE CATALOG IF NOT EXISTS fraud;
CREATE SCHEMA IF NOT EXISTS fraud.models;The model is then registered as fraud.models.<name>. The catalog and schema are not created implicitly. Registering into a missing schema fails with an error that names the schema.
Where the model files are stored
The registered model is a metadata record. The model artifacts, such as the pickled estimator and the MLmodel file, live in storage managed by Unity Catalog. Their location is resolved through the hierarchy. A schema's managed storage location is used if it has one. Otherwise the catalog's is used, and the metastore's is the final fallback. You do not choose a path when you register a model, and you should not read or write those files directly. Access goes through Unity Catalog, which is how privileges are enforced.
Common mistakes
- Using a flat name.
registered_model_name="iris_classifier"with the Unity Catalog registry fails. Use all three parts. - Forgetting the registry URI. Without
mlflow.set_registry_uri("databricks-uc"), MLflow uses the workspace registry. - Assuming a missing schema is created. It is not. Create the catalog and schema first.
- Mixing up case. Names are stored lowercase. Do not rely on case to distinguish two models.
- Hard-coding version numbers in callers. A version is a child of the name. Use an alias when a caller should follow whichever version is current.
- Expecting workspace-level isolation. Models are scoped to the metastore, not to a workspace. Two workspaces on one metastore share the same model.
Summary
A registered model is a Unity Catalog object identified by catalog.schema.model. It sits in a schema beside tables and functions, and its owner and privileges are separate from the data it was trained on. Versions are integers created each time you register. Aliases are movable pointers to versions. Models belong to the metastore, so every attached workspace can see them. To use any of this from MLflow, set the registry URI to databricks-uc and always pass the full name.
Exercise
A teammate runs mlflow.sklearn.log_model(model, "model", registered_model_name="Fraud_Scorer") and gets an error. They want the model registered as Fraud_Scorer in the schema risk.models. What two changes does the call need, and how will the stored name appear?
Show answer
First, call mlflow.set_registry_uri("databricks-uc") so MLflow uses the Unity Catalog registry instead of the workspace registry. Second, change the name to the full three-level form, risk.models.Fraud_Scorer. The risk catalog and models schema must already exist. Unity Catalog stores the name in lowercase, so it appears as risk.models.fraud_scorer.
Exercise
Two workspaces are attached to the same metastore. A model prod.fraud.scorer is registered from workspace A. Can a user in workspace B load it, and what decides this? Why is a version number not part of the name?
Show answer
Yes, if the user has the required privileges. Models belong to the metastore, so every workspace attached to it sees the same objects, and access is decided by Unity Catalog privileges on the catalog, schema, and model, not by workspace. The version is not part of the name because the name identifies the registered model, which is a container. Each registration adds a new version inside it, and callers add a version (/2) or an alias (@champion) to the URI when they need a specific one.