Registering, deploying, and querying custom models
Databricks Machine Learning Professional · Lesson 22 of 22 · 2:41:21
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Machine Learning Professional exam. In this lesson: logging and registering a custom model in Unity Catalog with an alias, deploying it to a Model Serving endpoint with the SDK, the REST API, or the Serving UI, querying it with REST, and other ways to query (the MLflow Deployments client, ai_query, and the Serving UI). Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Three clients, one model
Pebblecove's price advice model is a custom PyFunc: it converts currencies, adds holiday features, and rounds the advice for hosts. The booking site, a nightly SQL report, and a partner's Python app all need its predictions. This lesson covers registering a custom model with its artifacts in Unity Catalog, deploying it in three ways, and querying it from REST, from Python, and from SQL.
Registering a custom model
A custom PyFunc model is registered in Unity Catalog when it is logged. Its log_model call passes the python model, and an artifacts dictionary, which names each file the model needs, like a regressor and a holiday calendar. MLflow copies these artifacts into the model, so the serving endpoint has them, even when they come from a Unity Catalog volume. An input example gives the signature that Unity Catalog requires, and pip_requirements pins the packages, with the full mlflow version. And registered_model_name, with three levels, catalog, schema, and model, creates a new version, which an alias like champion can point to.
Deploying it
A registered model can be deployed in three ways, and all of them create the same kind of endpoint. In the Serving UI, create a serving endpoint, choose the model in Unity Catalog and its version, then the compute size, and whether it scales to zero. With the REST API, a post request to the serving endpoints API sends a name, and a config whose served_entities list gives the entity name, the version, and the compute. With the MLflow Deployments SDK, get_deploy_client for Databricks returns a client, and its create_endpoint method takes the same name and config; the Databricks SDK offers the same. Whatever the method, the endpoint builds a container with the model and its packages, and accepts requests once its state is ready.
Querying with REST
Once ready, the endpoint answers at its invocations URL: the workspace address, then serving endpoints, the endpoint name, and invocations. A client sends a post request with a token in the authorization header, ideally a machine to machine OAuth token in production, and a body in a supported format. The dataframe_split format sends the column names once, then the rows of data, while dataframe_records sends one object per row, and tensors use instances or inputs. The response holds a predictions field, with one prediction for each row, in the same order.
Other ways to query
Other clients have simpler options. In Python, the MLflow Deployments SDK handles the authentication and the request: get_deploy_client for Databricks, then predict, with the endpoint name and the inputs, in the same formats. In SQL, the ai_query function calls the endpoint for each row of a query, which suits batch reports. The Serving UI has a query endpoint button, to send a test request, and to load the logged input example. And on an endpoint with several served entities, a URL with the served model name reaches one version directly, without the routes.
Recap
Let's recap. A custom PyFunc is logged with its artifacts, an input example, pip_requirements, and a three level registered_model_name. Deploy it from the Serving UI, the REST API, or the MLflow Deployments SDK with create_endpoint and served_entities. Query it with a post request to its invocations URL, with a token, and a body like dataframe_split. Python clients can call predict from the MLflow Deployments SDK, and SQL can call ai_query. And a served model URL reaches one version behind the routes.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Registering the custom model in Unity Catalog fails, with an error about a missing signature. What fixes it?
- Add mlflow to pip_requirements
- Set the champion alias first
- Pass an input example, or a signature
- Use a two-level model name
Show the answer
Pass an input example, or a signature
Unity Catalog requires a signature, which MLflow infers from an input example, or which you pass yourself. “Add mlflow to pip_requirements” would pin packages, which does not describe the inputs and outputs. “Set the champion alias first” would come after registration, since an alias points to an existing version. And “Use a two-level model name” is wrong, since Unity Catalog needs three levels.
A CI script in Python creates every serving endpoint through the MLflow Deployments SDK. Which call creates the endpoint?
- client.predict(endpoint=..., inputs=...)
- mlflow.pyfunc.log_model(...)
- mlflow.models.predict(model_uri, ...)
- client.create_endpoint(name=..., config=...)
Show the answer
client.create_endpoint(name=..., config=...)
Create_endpoint takes the endpoint name and a config, with its served_entities. “client.predict(endpoint=..., inputs=...)” would send data to an endpoint that already exists. “mlflow.pyfunc.log_model(...)” would log and registers a model, but serves nothing. And “mlflow.models.predict(model_uri, ...)” would validate a model locally, before any deployment.
A nightly SQL report must add the price advice to each row of a table, without leaving SQL. Which method fits?
- The MLflow Deployments SDK in Python
- The ai_query function
- The Query endpoint button
- mlflow.pyfunc.log_model
Show the answer
The ai_query function
Ai_query calls the serving endpoint from SQL, for each row of the query. “The MLflow Deployments SDK in Python” is a Python client, outside the SQL report. “The Query endpoint button” would send one test request by hand. And “mlflow.pyfunc.log_model” would log a model, and returns no predictions.