model_versions
Creates, updates, deletes, gets or lists a model_versions resource.
Overview
| Name | model_versions |
| Type | Resource |
| Id | databricks_workspace.catalog.model_versions |
Fields
The following fields are returned by SELECT queries:
- get
- get_by_alias
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the model version |
metastore_id | string | The unique identifier of the metastore containing the model version |
run_id | string | MLflow run ID used when creating the model version, if ``source`` was generated by an experiment run stored in an MLflow tracking server |
run_workspace_id | integer | ID of the Databricks workspace containing the MLflow run that generated this model version, if applicable |
catalog_name | string | The name of the catalog containing the model version |
model_name | string | The name of the parent registered model of the model version, relative to parent schema |
schema_name | string | The name of the schema containing the model version, relative to parent catalog |
aliases | array | |
comment | string | The comment attached to the model version |
created_at | integer | |
created_by | string | The identifier of the user who created the model version |
model_version_dependencies | object | Model version dependencies, for feature-store packaged models |
source | string | URI indicating the location of the source artifacts (files) for the model version |
status | string | Current 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_location | string | The storage location on the cloud under which model version data files are stored |
updated_at | integer | |
updated_by | string | The identifier of the user who updated the model version last time |
version | integer | Integer model version number, used to reference the model version in API requests. |
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the model version |
metastore_id | string | The unique identifier of the metastore containing the model version |
run_id | string | MLflow run ID used when creating the model version, if ``source`` was generated by an experiment run stored in an MLflow tracking server |
run_workspace_id | integer | ID of the Databricks workspace containing the MLflow run that generated this model version, if applicable |
catalog_name | string | The name of the catalog containing the model version |
model_name | string | The name of the parent registered model of the model version, relative to parent schema |
schema_name | string | The name of the schema containing the model version, relative to parent catalog |
aliases | array | |
comment | string | The comment attached to the model version |
created_at | integer | |
created_by | string | The identifier of the user who created the model version |
model_version_dependencies | object | Model version dependencies, for feature-store packaged models |
source | string | URI indicating the location of the source artifacts (files) for the model version |
status | string | Current 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_location | string | The storage location on the cloud under which model version data files are stored |
updated_at | integer | |
updated_by | string | The identifier of the user who updated the model version last time |
version | integer | Integer model version number, used to reference the model version in API requests. |
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the model version |
metastore_id | string | The unique identifier of the metastore containing the model version |
run_id | string | MLflow run ID used when creating the model version, if ``source`` was generated by an experiment run stored in an MLflow tracking server |
run_workspace_id | integer | ID of the Databricks workspace containing the MLflow run that generated this model version, if applicable |
catalog_name | string | The name of the catalog containing the model version |
model_name | string | The name of the parent registered model of the model version, relative to parent schema |
schema_name | string | The name of the schema containing the model version, relative to parent catalog |
aliases | array | |
comment | string | The comment attached to the model version |
created_at | integer | |
created_by | string | The identifier of the user who created the model version |
model_version_dependencies | object | Model version dependencies, for feature-store packaged models |
source | string | URI indicating the location of the source artifacts (files) for the model version |
status | string | Current 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_location | string | The storage location on the cloud under which model version data files are stored |
updated_at | integer | |
updated_by | string | The identifier of the user who updated the model version last time |
version | integer | Integer model version number, used to reference the model version in API requests. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | full_name, version, deployment_name | include_aliases, include_browse | Get a model version. |
get_by_alias | select | full_name, alias, deployment_name | include_aliases | Get a model version by alias. |
list | select | full_name, deployment_name | include_browse, max_results, page_token | List model versions. You can list model versions under a particular schema, or list all model versions |
update | update | full_name, version, deployment_name | Updates the specified model version. | |
delete | delete | full_name, version, deployment_name | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
alias | string | The name of the alias |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
full_name | string | The three-level (fully qualified) name of the model version |
version | integer | The integer version number of the model version |
include_aliases | boolean | Whether to include aliases associated with the model version in the response |
include_browse | boolean | Whether to include model versions in the response for which the principal can only access selective metadata for |
max_results | integer | 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 | string | Opaque pagination token to go to next page based on previous query. |
SELECT examples
- get
- get_by_alias
- list
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 }}'
;
Get a model version by alias.
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 alias = '{{ alias }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_aliases = '{{ include_aliases }}'
;
List model versions. You can list model versions under a particular schema, or list all model versions
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 deployment_name = '{{ deployment_name }}' -- required
AND include_browse = '{{ include_browse }}'
AND max_results = '{{ max_results }}'
AND page_token = '{{ page_token }}'
;
UPDATE examples
- update
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
- delete
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
;