A user can only load their own model, the
ML_MODEL_LOAD
user
parameter is ignored, and it is not
possible to share a model. See
Section 2.3.8, “CREATE TABLE ... SELECT Statements” for an
alternative method.
Sharing a model requires granting model catalog privileges to another user. You can only share a model with another MySQL user on the same MySQL DB System.
To grant model catalog privileges, issue a statement similar to the following:
mysql> GRANT SELECT, ALTER, INSERT, CREATE, UPDATE, DROP, GRANT OPTION
ON ML_SCHEMA_user1.MODEL_CATALOG
TO 'user2'@'%';
where:
ML_SCHEMA_
is the fully qualified name of theuser1
.MODEL_CATALOGMODEL_CATALOG
table. The schema is named for the user that created the model.'
is the user you want to grant access to.user2
'@'%
'
The user that is granted model catalog privileges must also
have the privileges required to use HeatWave AutoML and the
CREATE
privilege on the
schema where ML_PREDICT_TABLE
or ML_EXPLAIN_TABLE
results
are written. See Section 3.2, “HeatWave AutoML Prerequisites”.
After a model catalog is shared with another user, that user
can access models in the catalog when running
ML_*
routines. For example,
'user2'@'%'
in the example above might
assign a model handle from the user1
model
catalog to a session variable, and call that session variable
from a ML_PREDICT_TABLE
routine. The model owner is responsible for loading a model
shared with other users.
mysql> SET @my_model = (SELECT model_handle
FROM ML_SCHEMA_user1.MODEL_CATALOG
WHERE train_table_name LIKE '%census_train%');
mysql> SELECT @my_model;
+--------------------------------------------------+
| @my_model |
+--------------------------------------------------+
| heatwaveml_bench.census_train_user1_1648167434 |
+--------------------------------------------------+
mysql> CALL sys.ML_PREDICT_TABLE('heatwaveml_bench.census_test_subset', @my_model,
'heatwaveml_bench.census_predictions');