MySQL HeatWave User Guide  /  ...  /  ML_MODEL_LOAD


The ML_MODEL_LOAD routine loads a model from the model catalog. A model remains loaded until the model is unloaded using the ML_MODEL_UNLOAD routine or until HeatWave ML is restarted by a HeatWave Cluster restart.

A model can only be loaded by the MySQL user that created the model or by a user that was granted privileges to access the owning user's model catalog. For more information, see Section 3.9.10, “Sharing Models”.

You can load multiple models but to avoid taking up too much space in memory, the number of loaded models should be limited to three.


CALL sys.ML_MODEL_LOAD(model_handle, user);

ML_MODEL_LOAD parameters:

  • model_handle: Specifies the model handle or a session variable containing the model handle. For how to look up a model handle, see Section 3.9.8, “Model Handles”.

  • user: The MySQL user name of the model owner. You can specify NULL in place of the user name if the model owner is the current user.

Syntax Examples

  • An ML_MODEL_LOAD call with NULL specified, indicating that the model belongs to the user executing the ML_MODEL_LOAD call:

    CALL sys.ML_MODEL_LOAD('ml_data.iris_train_user1_1636729526', NULL);
  • An ML_MODEL_LOAD call that specifies the model owner:

    CALL sys.ML_MODEL_LOAD('ml_data.iris_train_user1_1636729526', 'user1');
  • An ML_MODEL_LOAD call that specifies a session variable containing the model handle:

    CALL sys.ML_MODEL_LOAD(@iris_model, NULL);