Below are the functions that let you work with multiple versions of a model.
Use the listVersions()
method to view all available versions of a model:
Model homeRentalsModel = mindsdb.getModel("home_rentals_model");
homeRentalsModel.listVersions();
Use the getVersion()
method to use a specific version of a model:
Project mindsdb = server.getProject("mindsdb");
Model homeRentalsModel = mindsdb.getModelWithVersion("home_rentals_model",1);
Use the setActive()
method to set a specific version of a model as active:
homeRentalsModel.setActive(1)
Use the dropModelVersion()
method to remove a specific version of a model:
Project mindsdb = server.getProject();
mindsdb.dropModelVersion("homeRentalsModel", 3);
// or
mindsdb.models.dropVersion(1);
Please note that the model version should be deactivated before it is removed.