Skip to content

[FEATURE] Native SDK support for reading and writing MLflow tags on Unity Catalog model versions #1313

@asanglard

Description

@asanglard

Problem Statement

When using Unity Catalog registered models in Databricks, MLflow tags set via MlflowClient.set_model_version_tag() are stored in an undocumented internal endpoint (/api/2.0/mlflow/unity-catalog/model-versions/set-tag and .../get). The ModelVersionsAPI and RegisteredModelsAPI in the SDK (w.model_versions, w.registered_models) only expose the Unity Catalog 2.1 REST layer, which does not expose these MLflow-layer tags.

As a result, developers who want to read or write MLflow tags on UC model versions have no first-class SDK method and are forced to call the internal, undocumented endpoint directly:

# Currently required workaround — undocumented endpoint:
client.api_client.do(
    "GET",
    "/api/2.0/mlflow/unity-catalog/model-versions/get",
    query={"name": "catalog.schema.model", "version": "1"},
)
client.api_client.do(
    "POST",
    "/api/2.0/mlflow/unity-catalog/model-versions/set-tag",
    body={"name": "catalog.schema.model", "version": 1, "key": "k", "value": "v"},
)

Proposed Solution

Add get_tags(), set_tag(), and delete_tag() methods to ModelVersionsAPI (and equivalently to RegisteredModelsAPI) that wrap the MLflow Unity Catalog tag endpoints, similar to the existing set_model_version_tag / delete_model_version_tag methods already present in ModelRegistryAPI (workspace registry):

# Desired SDK interface:
w.model_versions.set_tag(full_name="catalog.schema.model", version=1, key="k", value="v")
tags = w.model_versions.get(full_name="catalog.schema.model", version=1).tags

Additional Context

  • SDK version: 0.97.0
  • The equivalent workspace-registry API (ml.ModelRegistryAPI) already has set_model_version_tag / delete_model_version_tag, so the pattern is established — it just hasn't been carried forward to the UC ModelVersionsAPI.
  • The tags are visible in the Databricks UI on the model version page and are set by standard MLflow training code (MlflowClient.set_model_version_tag()), so reading/writing them is a common operational need (e.g. flagging a model version as archived, setting deployment metadata).
  • Related undocumented endpoints: POST /api/2.0/mlflow/unity-catalog/model-versions/set-tag, GET /api/2.0/mlflow/unity-catalog/model-versions/get.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions