Skip to main content

model_versions

Creates, updates, deletes, gets or lists a model_versions resource.

Overview

Namemodel_versions
TypeResource
Iddatabricks_workspace.unitycatalog.model_versions

Fields

The following fields are returned by SELECT queries:

The model version list was successfully retrieved

NameDatatypeDescription
idstring
metastore_idstring
run_idstring
run_workspace_idstring
catalog_namestring
model_namestring
schema_namestring
commentstring
created_atinteger
created_bystring
sourcestring
statusstring
storage_locationstring
updated_atinteger
updated_bystring
versioninteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdeployment_nameList model versions. You can list model versions under a particular schema, or list all model versions in the current metastore.
getbyaliasselectdeployment_nameGet a model version by alias.
getselectdeployment_nameGet a model version.
updateupdatedeployment_nameUpdates the specified model version.
deletedeletedeployment_nameDeletes a model version from the specified registered model. Any aliases assigned to the model version will also be deleted.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples

List model versions. You can list model versions under a particular schema, or list all model versions in the current metastore.

SELECT
id,
metastore_id,
run_id,
run_workspace_id,
catalog_name,
model_name,
schema_name,
comment,
created_at,
created_by,
source,
status,
storage_location,
updated_at,
updated_by,
version
FROM databricks_workspace.unitycatalog.model_versions
WHERE deployment_name = '{{ deployment_name }}' -- required;

UPDATE examples

Updates the specified model version.

UPDATE databricks_workspace.unitycatalog.model_versions
SET
data__comment = '{{ comment }}'
WHERE
deployment_name = '{{ deployment_name }}' --required
RETURNING
id,
metastore_id,
run_id,
run_workspace_id,
catalog_name,
model_name,
schema_name,
comment,
created_at,
created_by,
source,
status,
storage_location,
updated_at,
updated_by,
version;

DELETE examples

Deletes a model version from the specified registered model. Any aliases assigned to the model version will also be deleted.

DELETE FROM databricks_workspace.unitycatalog.model_versions
WHERE deployment_name = '{{ deployment_name }}' --required;