w.model_versions
: Model Versions¶
- class databricks.sdk.service.catalog.ModelVersionsAPI¶
Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in Unity Catalog provide centralized access control, auditing, lineage, and discovery of ML models across Databricks workspaces.
This API reference documents the REST endpoints for managing model versions in Unity Catalog. For more details, see the [registered models API docs](/api/workspace/registeredmodels).
- delete(full_name: str, version: int)¶
Delete a Model Version.
Deletes a model version from the specified registered model. Any aliases assigned to the model version will also be deleted.
The caller must be a metastore admin or an owner of the parent registered model. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.
- Parameters:
full_name – str The three-level (fully qualified) name of the model version
version – int The integer version number of the model version
- get(full_name: str, version: int [, include_browse: Optional[bool]]) RegisteredModelInfo ¶
Get a Model Version.
Get a model version.
The caller must be a metastore admin or an owner of (or have the EXECUTE privilege on) the parent registered model. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.
- Parameters:
full_name – str The three-level (fully qualified) name of the model version
version – int The integer version number of the model version
include_browse – bool (optional) Whether to include model versions in the response for which the principal can only access selective metadata for
- Returns:
- get_by_alias(full_name: str, alias: str) ModelVersionInfo ¶
Get Model Version By Alias.
Get a model version by alias.
The caller must be a metastore admin or an owner of (or have the EXECUTE privilege on) the registered model. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.
- Parameters:
full_name – str The three-level (fully qualified) name of the registered model
alias – str The name of the alias
- Returns:
- list(full_name: str [, include_browse: Optional[bool], max_results: Optional[int], page_token: Optional[str]]) Iterator[ModelVersionInfo] ¶
List Model Versions.
List model versions. You can list model versions under a particular schema, or list all model versions in the current metastore.
The returned models are filtered based on the privileges of the calling user. For example, the metastore admin is able to list all the model versions. A regular user needs to be the owner or have the EXECUTE privilege on the parent registered model to recieve the model versions in the response. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.
There is no guarantee of a specific ordering of the elements in the response. The elements in the response will not contain any aliases or tags.
- Parameters:
full_name – str The full three-level name of the registered model under which to list model versions
include_browse – bool (optional) Whether to include model versions in the response for which the principal can only access selective metadata for
max_results – int (optional) Maximum number of model versions to return. If not set, the page length is set to a server configured value (100, as of 1/3/2024). - when set to a value greater than 0, the page length is the minimum of this value and a server configured value(1000, as of 1/3/2024); - when set to 0, the page length is set to a server configured value (100, as of 1/3/2024) (recommended); - when set to a value less than 0, an invalid parameter error is returned;
page_token – str (optional) Opaque pagination token to go to next page based on previous query.
- Returns:
Iterator over
ModelVersionInfo
- update(full_name: str, version: int [, comment: Optional[str]]) ModelVersionInfo ¶
Update a Model Version.
Updates the specified model version.
The caller must be a metastore admin or an owner of the parent registered model. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.
Currently only the comment of the model version can be updated.
- Parameters:
full_name – str The three-level (fully qualified) name of the model version
version – int The integer version number of the model version
comment – str (optional) The comment attached to the model version
- Returns: