Share via


model-versions command group

Note

This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

The model-versions command group within the Databricks CLI contains commands to manage model versions in the model registry in Unity Catalog. Models in Unity Catalog provide centralized access control, auditing, lineage, and discovery of ML models across Databricks workspaces. See Manage model lifecycle in Unity Catalog.

databricks model-versions delete

Delete 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.

databricks model-versions delete FULL_NAME VERSION [flags]

Arguments

FULL_NAME

    The three-level (fully qualified) name of the model version

VERSION

    The integer version number of the model version

Options

Global flags

Examples

The following example deletes version 1 of a model:

databricks model-versions delete main.my_schema.my_model 1

databricks model-versions get

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.

databricks model-versions get FULL_NAME VERSION [flags]

Arguments

FULL_NAME

    The three-level (fully qualified) name of the model version

VERSION

    The integer version number of the model version

Options

--include-aliases

    Whether to include aliases associated with the model version in the response.

--include-browse

    Whether to include model versions in the response for which the principal can only access selective metadata for.

Global flags

Examples

The following example gets version 1 of a model:

databricks model-versions get main.my_schema.my_model 1

The following example gets version 1 of a model with aliases included:

databricks model-versions get main.my_schema.my_model 1 --include-aliases

databricks model-versions get-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.

databricks model-versions get-by-alias FULL_NAME ALIAS [flags]

Arguments

FULL_NAME

    The three-level (fully qualified) name of the registered model

ALIAS

    The name of the alias

Options

--include-aliases

    Whether to include aliases associated with the model version in the response.

Global flags

Examples

The following example gets a model version by alias:

databricks model-versions get-by-alias main.my_schema.my_model production

The following example gets a model version by alias with aliases included:

databricks model-versions get-by-alias main.my_schema.my_model production --include-aliases

databricks model-versions list

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.

databricks model-versions list FULL_NAME [flags]

Arguments

FULL_NAME

    The full three-level name of the registered model under which to list model versions

Options

--include-browse

    Whether to include model versions in the response for which the principal can only access selective metadata for.

--max-results int

    Maximum number of model versions to return.

--page-token string

    Opaque pagination token to go to next page based on previous query.

Global flags

Examples

The following example lists all model versions for a registered model:

databricks model-versions list main.my_schema.my_model

The following example lists model versions with pagination:

databricks model-versions list main.my_schema.my_model --max-results 10 --page-token abc123token

databricks model-versions update

Update 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.

databricks model-versions update FULL_NAME VERSION [flags]

Arguments

FULL_NAME

    The three-level (fully qualified) name of the model version

VERSION

    The integer version number of the model version

Options

--comment string

    The comment attached to the model version.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

Global flags

Examples

The following example updates a model version comment:

databricks model-versions update main.my_schema.my_model 1 --comment "Updated model with improved accuracy"

The following example updates a model version using a JSON file:

databricks model-versions update main.my_schema.my_model 1 --json @model-version-update.json

Global flags

--debug

  Whether to enable debug logging.

-h or --help

    Display help for the Databricks CLI or the related command group or the related command.

--log-file string

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

--log-format format

    The log format type, text or json. The default value is text.

--log-level string

    A string representing the log format level. If not specified then the log format level is disabled.

-o, --output type

    The command output type, text or json. The default value is text.

-p, --profile string

    The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.

--progress-format format

    The format to display progress logs: default, append, inplace, or json

-t, --target string

    If applicable, the bundle target to use