PATCH /v1/services/mlmodelServices/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.services.mlmodelService import MlModelService
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.getcollate.io/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Retrieve, modify, and update
svc = metadata.get_by_id(entity=MlModelService, entity_id="ca22d46e-81b9-4e48-85b5-0adc44980da9")
modified = svc.model_copy(deep=True)
modified.description = "Updated: Production MLflow tracking server with model registry"
modified.connection.config.trackingUri = "http://mlflow-prod:8088"
modified.connection.config.registryUri = "http://mlflow-prod:8088"
updated = metadata.patch(entity=MlModelService, source=svc, destination=modified)
print(f"Updated to version {updated.version.root}")
import org.openmetadata.schema.entity.services.MlModelService;
import org.openmetadata.sdk.fluent.MlModelServices;
// client is an initialized OpenMetadataClient.
MlModelServices.setDefaultClient(client);
// Retrieve, modify, and update
MlModelService service = MlModelServices.retrieve("ca22d46e-81b9-4e48-85b5-0adc44980da9");
service.setDescription("Updated: Production MLflow tracking server with model registry");
MlModelService updated = MlModelServices.update(service);
# Update by ID
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/name/mlflow_svc" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
{
"id": "ca22d46e-81b9-4e48-85b5-0adc44980da9",
"name": "mlflow_svc",
"fullyQualifiedName": "mlflow_svc",
"serviceType": "Mlflow",
"description": "Updated: Production MLflow tracking server with model registry",
"version": 0.2,
"updatedAt": 1769982621618,
"updatedBy": "admin",
"href": "http://localhost:8585/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9",
"connection": {
"config": {
"type": "Mlflow",
"trackingUri": "http://mlflow-prod:8088",
"registryUri": "http://mlflow-prod:8088",
"supportsMetadataExtraction": true
}
},
"owners": [],
"tags": [],
"deleted": false,
"domains": []
}
Update an ML Model Service
Update ML model service connection properties using JSON Patch operations to modify configuration, authentication, owners, and tags via the Collate REST API.
PATCH
/
v1
/
services
/
mlmodelServices
/
{id}
PATCH /v1/services/mlmodelServices/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.services.mlmodelService import MlModelService
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.getcollate.io/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Retrieve, modify, and update
svc = metadata.get_by_id(entity=MlModelService, entity_id="ca22d46e-81b9-4e48-85b5-0adc44980da9")
modified = svc.model_copy(deep=True)
modified.description = "Updated: Production MLflow tracking server with model registry"
modified.connection.config.trackingUri = "http://mlflow-prod:8088"
modified.connection.config.registryUri = "http://mlflow-prod:8088"
updated = metadata.patch(entity=MlModelService, source=svc, destination=modified)
print(f"Updated to version {updated.version.root}")
import org.openmetadata.schema.entity.services.MlModelService;
import org.openmetadata.sdk.fluent.MlModelServices;
// client is an initialized OpenMetadataClient.
MlModelServices.setDefaultClient(client);
// Retrieve, modify, and update
MlModelService service = MlModelServices.retrieve("ca22d46e-81b9-4e48-85b5-0adc44980da9");
service.setDescription("Updated: Production MLflow tracking server with model registry");
MlModelService updated = MlModelServices.update(service);
# Update by ID
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/name/mlflow_svc" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
{
"id": "ca22d46e-81b9-4e48-85b5-0adc44980da9",
"name": "mlflow_svc",
"fullyQualifiedName": "mlflow_svc",
"serviceType": "Mlflow",
"description": "Updated: Production MLflow tracking server with model registry",
"version": 0.2,
"updatedAt": 1769982621618,
"updatedBy": "admin",
"href": "http://localhost:8585/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9",
"connection": {
"config": {
"type": "Mlflow",
"trackingUri": "http://mlflow-prod:8088",
"registryUri": "http://mlflow-prod:8088",
"supportsMetadataExtraction": true
}
},
"owners": [],
"tags": [],
"deleted": false,
"domains": []
}
Update an ML Model Service
Update an ML model service’s properties using JSON Merge Patch. You can update by ID or by fully qualified name.The Python examples on this page use the original client (
metadata.ingestion.ometa.ometa_api.OpenMetadata). For more information, see Which Python SDK Should I Use?.Update by ID
Update by Name
UsePATCH /v1/services/mlmodelServices/name/{fqn} to update by fully qualified name.
Body Parameters
Send a JSON object with the fields to update. Only provided fields are changed.PATCH /v1/services/mlmodelServices/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.services.mlmodelService import MlModelService
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.getcollate.io/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Retrieve, modify, and update
svc = metadata.get_by_id(entity=MlModelService, entity_id="ca22d46e-81b9-4e48-85b5-0adc44980da9")
modified = svc.model_copy(deep=True)
modified.description = "Updated: Production MLflow tracking server with model registry"
modified.connection.config.trackingUri = "http://mlflow-prod:8088"
modified.connection.config.registryUri = "http://mlflow-prod:8088"
updated = metadata.patch(entity=MlModelService, source=svc, destination=modified)
print(f"Updated to version {updated.version.root}")
import org.openmetadata.schema.entity.services.MlModelService;
import org.openmetadata.sdk.fluent.MlModelServices;
// client is an initialized OpenMetadataClient.
MlModelServices.setDefaultClient(client);
// Retrieve, modify, and update
MlModelService service = MlModelServices.retrieve("ca22d46e-81b9-4e48-85b5-0adc44980da9");
service.setDescription("Updated: Production MLflow tracking server with model registry");
MlModelService updated = MlModelServices.update(service);
# Update by ID
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
# Update by name
curl -X PATCH "{base_url}/api/v1/services/mlmodelServices/name/mlflow_svc" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated: Production MLflow tracking server with model registry"}
]'
{
"id": "ca22d46e-81b9-4e48-85b5-0adc44980da9",
"name": "mlflow_svc",
"fullyQualifiedName": "mlflow_svc",
"serviceType": "Mlflow",
"description": "Updated: Production MLflow tracking server with model registry",
"version": 0.2,
"updatedAt": 1769982621618,
"updatedBy": "admin",
"href": "http://localhost:8585/api/v1/services/mlmodelServices/ca22d46e-81b9-4e48-85b5-0adc44980da9",
"connection": {
"config": {
"type": "Mlflow",
"trackingUri": "http://mlflow-prod:8088",
"registryUri": "http://mlflow-prod:8088",
"supportsMetadataExtraction": true
}
},
"owners": [],
"tags": [],
"deleted": false,
"domains": []
}
Returns
Returns the updated ML model service object with the new version number.Response
Error Handling
| Code | Error Type | Description |
|---|---|---|
400 | BAD_REQUEST | Invalid JSON patch or malformed request |
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission to update this ML model service |
404 | NOT_FOUND | ML model service with given ID or FQN does not exist |
409 | CONFLICT | Concurrent modification detected |
Was this page helpful?