Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is in Public Preview. Workspace admins can control access to this feature from the Previews page. See Manage Azure Databricks previews.
You can serve Feature Views online in two ways:
- Model serving: Deploy a model that was trained on Feature Views. The endpoint looks up feature values from the online store automatically, using the lineage tracked when the model was logged. Use this to serve model predictions.
- Feature Serving: Deploy a
FeatureSpecthat references Feature Views directly, without a model. The endpoint returns the looked-up feature values. Use this when an application needs feature values rather than model predictions.
Both approaches read precomputed feature values from an online store, so you must first materialize the features to an online store.
Models that are trained using features from Databricks automatically track lineage to the features they were trained on. When deployed as model serving endpoints, these models use Unity Catalog to look up features from online stores.
Permissions
To serve a feature, the principal that creates the model serving endpoint must have SELECT on the Unity Catalog table that backs the materialized feature. Online lookups read directly from the materialized table, so table-level SELECT is what grants serving access. For the privilege description, see SELECT.
Because a materialized table can hold more than one feature, granting SELECT on it grants access to every feature in that table, not only the one you intend to serve. Before you grant serving access, confirm that every feature sharing the table can be shared with the principal. To limit exposure, materialize sensitive features separately.
To grant this access without resolving tables by hand, use FeatureEngineeringClient.grant_feature_serving_access. Given a model or feature spec, it resolves each feature to its online table, grants SELECT (along with USE CATALOG and USE SCHEMA) on those tables to the principals you specify, and returns a report of each table and the additional features the grant exposes. Pass dry_run=True to preview the report before granting.
from databricks.feature_engineering import FeatureEngineeringClient
fe = FeatureEngineeringClient()
# Preview the tables and the features each grant would expose.
report = fe.grant_feature_serving_access(
grant_to=["serving-principal@example.com"],
model_uri="models:/main.ecommerce.fraud_model/1",
dry_run=True,
)
print(report)
# Grant SELECT on the resolved online tables.
fe.grant_feature_serving_access(
grant_to=["serving-principal@example.com"],
model_uri="models:/main.ecommerce.fraud_model/1",
)
Deploy a model serving endpoint
Use an existing model serving endpoint, or use the Databricks SDK to create a new one. The model must be registered in Unity Catalog.
The following code shows how to create a new model serving endpoint. For more information, see Create custom model serving endpoints.
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import EndpointCoreConfigInput, ServedEntityInput
w = WorkspaceClient()
endpoint_name = "fraud-detection-endpoint"
model_name = "main.ecommerce.fraud_model"
w.serving_endpoints.create(
name=endpoint_name,
config=EndpointCoreConfigInput(
name=endpoint_name,
served_entities=[
ServedEntityInput(
entity_name=model_name,
entity_version=1,
max_provisioned_concurrency=4,
min_provisioned_concurrency=0,
)
],
),
)
Query the endpoint
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="fraud-detection-endpoint",
dataframe_records=[
{"user_id": "user_123", "transaction_time": "2026-03-01T12:00:00"},
],
)
Query the endpoint with RequestSource features
If the model was trained with RequestSource features, the request payload must also include all RequestSource columns. These columns were added to the MLflow model signature during log_model, so the endpoint's API schema reflects the required request fields.
response = w.serving_endpoints.query(
name="fraud-detection-endpoint",
dataframe_records=[
{
"user_id": "user_123",
"transaction_time": "2026-03-01T12:00:00",
"transaction_amount": 275.30, # RequestSource column
"vendor_id": "v_42", # RequestSource column (also used as entity key)
},
],
)
Entity keys are used for looking up table-backed features from the online store. RequestSource columns are passed through directly to the model.
You can also use curl:
curl -X POST "https://<workspace>.cloud.databricks.com/serving-endpoints/<endpoint>/invocations" \
-H "Authorization: Bearer $DATABRICKS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dataframe_records": [
{
"user_id": "user_123",
"transaction_time": "2026-03-01T12:00:00",
"transaction_amount": 275.30,
"vendor_id": "v_42"
}
]
}'
Serve features with a FeatureSpec
To serve Feature Views without a model, create a FeatureSpec that references the features and deploy it to a Feature Serving endpoint. The endpoint returns the looked-up feature values for the entity keys in the request.
The features must be registered in Unity Catalog and materialized to an online store before you create the endpoint.
Note
A FeatureSpec that contains Feature Views cannot also contain FeatureLookup or FeatureFunction definitions. Feature Views cannot be mixed with those definitions in the same FeatureSpec.
from databricks.feature_engineering import FeatureEngineeringClient
from databricks.feature_engineering.entities.feature_serving_endpoint import (
EndpointCoreConfig,
ServedEntity,
)
fe = FeatureEngineeringClient()
# 1. Retrieve a registered Feature View
agg_feature = fe.get_feature(full_name="main.ecommerce.amount_sum_sliding_7d_1d")
# 2. Create a FeatureSpec that includes the Feature View
feature_spec_name = "main.ecommerce.transaction_feature_spec"
fe.create_feature_spec(name=feature_spec_name, features=[agg_feature])
# 3. Deploy a Feature Serving endpoint backed by the FeatureSpec
fe.create_feature_serving_endpoint(
name="transaction-features",
config=EndpointCoreConfig(
served_entities=ServedEntity(
feature_spec_name=feature_spec_name,
workload_size="Small",
scale_to_zero_enabled=True,
)
),
)
Query the endpoint with the entity keys used to look up the materialized features:
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="transaction-features",
dataframe_records=[{"user_id": "user_123"}],
)
For more about Feature Serving endpoints see Feature Serving endpoints.