databricksmlflowdatabricks-unity-catalog

How to set model owner programmatically within databricks and mlflow?


Looking at the documentation of MLFlow and Databricks, you can nicely manage the owner of (feature) tables with ALTER TABLE <table_name> SET OWNER TO `<owner_name>`; however, you cannot do this programmatically with MLFlow models. The docs do not specify any of this. Neither when creating the model (then it is always the user that creates the model), nor after the model was created. One can change the owner in the databricks catalog UI. However this wouldn't scale and needs manual change after each creation.

Are there any ways on how to accomplish this?

PS: ChatGPT suggested workarounds as this is currently not doable within an MLFlow and Databricks setting.

There is no command available. There are ways on accomplishing this loading the model each time through the path directly, but this does not fit the idea of the unity catalog to manage permissions etc in one place.


Solution

  • Thanks a lot. I solved it by using the API through the Databricks SDK for Python by:

    from databricks.sdk import WorkspaceClient
    
    w = WorkspaceClient()
    
    w.registered_models.update(registered_model_name_fqtn, owner=owner)