Skip to main content

model_versions

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

Overview

Namemodel_versions
TypeResource
Iddatabricks_workspace.catalog.model_versions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the model version
metastore_idstringThe unique identifier of the metastore containing the model version
run_idstringMLflow run ID used when creating the model version, if ``source`` was generated by an experiment run stored in an MLflow tracking server
run_workspace_idintegerID of the Databricks workspace containing the MLflow run that generated this model version, if applicable
catalog_namestringThe name of the catalog containing the model version
model_namestringThe name of the parent registered model of the model version, relative to parent schema
schema_namestringThe name of the schema containing the model version, relative to parent catalog
aliasesarray
commentstringThe comment attached to the model version
created_atinteger
created_bystringThe identifier of the user who created the model version
model_version_dependenciesobjectModel version dependencies, for feature-store packaged models
sourcestringURI indicating the location of the source artifacts (files) for the model version
statusstringCurrent status of the model version. Newly created model versions start in PENDING_REGISTRATION status, then move to READY status once the model version files are uploaded and the model version is finalized. Only model versions in READY status can be loaded for inference or served. (FAILED_REGISTRATION, MODEL_VERSION_STATUS_UNKNOWN, PENDING_REGISTRATION, READY)
storage_locationstringThe storage location on the cloud under which model version data files are stored
updated_atinteger
updated_bystringThe identifier of the user who updated the model version last time
versionintegerInteger model version number, used to reference the model version in API requests.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfull_name, version, deployment_nameinclude_aliases, include_browseGet a model version.
get_by_aliasselectfull_name, alias, deployment_nameinclude_aliasesGet a model version by alias.
listselectfull_name, deployment_nameinclude_browse, max_results, page_tokenList model versions. You can list model versions under a particular schema, or list all model versions
updateupdatefull_name, version, deployment_nameUpdates the specified model version.
deletedeletefull_name, version, deployment_nameDeletes a model version from the specified registered model. Any aliases assigned to the model version

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
aliasstringThe name of the alias
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
full_namestringThe three-level (fully qualified) name of the model version
versionintegerThe integer version number of the model version
include_aliasesbooleanWhether to include aliases associated with the model version in the response
include_browsebooleanWhether to include model versions in the response for which the principal can only access selective metadata for
max_resultsintegerMaximum 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_tokenstringOpaque pagination token to go to next page based on previous query.

SELECT examples

Get a model version.

SELECT
id,
metastore_id,
run_id,
run_workspace_id,
catalog_name,
model_name,
schema_name,
aliases,
comment,
created_at,
created_by,
model_version_dependencies,
source,
status,
storage_location,
updated_at,
updated_by,
version
FROM databricks_workspace.catalog.model_versions
WHERE full_name = '{{ full_name }}' -- required
AND version = '{{ version }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_aliases = '{{ include_aliases }}'
AND include_browse = '{{ include_browse }}'
;

UPDATE examples

Updates the specified model version.

UPDATE databricks_workspace.catalog.model_versions
SET
aliases = '{{ aliases }}',
catalog_name = '{{ catalog_name }}',
comment = '{{ comment }}',
created_at = {{ created_at }},
created_by = '{{ created_by }}',
id = '{{ id }}',
metastore_id = '{{ metastore_id }}',
model_name = '{{ model_name }}',
model_version_dependencies = '{{ model_version_dependencies }}',
run_id = '{{ run_id }}',
run_workspace_id = {{ run_workspace_id }},
schema_name = '{{ schema_name }}',
source = '{{ source }}',
status = '{{ status }}',
storage_location = '{{ storage_location }}',
updated_at = {{ updated_at }},
updated_by = '{{ updated_by }}'
WHERE
full_name = '{{ full_name }}' --required
AND version = '{{ version }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
id,
metastore_id,
run_id,
run_workspace_id,
catalog_name,
model_name,
schema_name,
aliases,
comment,
created_at,
created_by,
model_version_dependencies,
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

DELETE FROM databricks_workspace.catalog.model_versions
WHERE full_name = '{{ full_name }}' --required
AND version = '{{ version }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;