cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to Delete Registered Models with Versions in Dev Environment (MLOps + DAB)

Tapestry2508
New Contributor II

Hi all,

I have a registered model deployed via DAB as part of our MLOps architecture. I'm looking to deploy this model, along with other resources (workflows, schemas, experiments, etc.), in our development environment, allowing team members to easily test and experiment with different approaches.

In our setup, development environment resources are deployed with a prefix that depends on the branch name. This allows multiple users to work on different branches simultaneously, with each branch deploying its own set of resources. When a branch is ready for merge, I run `databricks bundle destroy --target dev` to clean up the associated resources for that specific branch.

This works well, except when the registered model in the dev environment contains a model version. In such cases, I encounter the following error:

`Error: cannot delete registered model: Function model_name_here is not empty. The function has 1 model version(s).`

Is there a way to overcome this limitation and delete the registered model with its version(s) in the dev environment?

Thanks for your help!

4 REPLIES 4

kunalmishra9
New Contributor III

Following here

anpm
New Contributor II

I have also run into this issue. You can delete the model programmatically in a notebook (client.delete_registered_model(name=model_name)) and then run the desired bundle command, but I would also really like a DAB native solution to this.

Tapestry2508
New Contributor II

Definitely! It would be great if the 'databricks bundle destroy' command had a flag that allowed you to remove registered models as well

I agree with you; the only solution I've found at the moment is to define a custom script for destroying the bundle, which first removes all model versions through the Mlflow Python API and then runs 'databricks bundle destroy'.

emerrf
New Contributor II

@Tapestry2508 please share your script for full bundle destroy. Maybe a github gist?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group