Use the
        ML_MODEL_EXPORT
        routine to export a model from the model catalog to a user
        defined table.
      
        To learn how to use
        ML_MODEL_EXPORT
        to share models, see
        Grant Other Users
        Access to a Model.
      
          After you run
          ML_MODEL_EXPORT,
          the output table has these columns and formats:
        
- 
chunk_id:INT AUTO_INCREMENT PRIMARY KEY
- 
model_object:LONGTEXT DEFAULT NULL
- 
model_metadata:JSONSee Model Metadata. 
          ML_MODEL_EXPORT
          should work regardless of
          model_metadata.status:
        
- 
If there is no corresponding row in the model_object_catalogfor an existingmodel_handlein theMODEL_CATALOG:There should be only one row in the output table with chunk_id= 0,model_object= NULL andmodel_metadata=MODEL_CATALOG.model_metadata.
- 
If there is at least one row in the model_object_catalogfor an existingmodel_handlein theMODEL_CATALOG:- There should be N rows in the output table with - chunk_idbeing 1 to N.
- ML_MODEL_EXPORTcopies the- model_objectfrom- model_object_catalogto the output table.
- model_metadatain the row with- chunk_id= 1 should be the same as in the- MODEL_CATALOG.
 
mysql> CALL sys.ML_MODEL_EXPORT (model_handle, output_table_name);
          ML_MODEL_EXPORT
          parameters:
        
- model_handle: The model handle for the model. See Work with Model Handles.
- output_table_name: The name for the output table.
- 
An example that exports an AutoML model with metadata to the model catalog (ML_SCHEMA_user1.model_export). The output table name is model_export. You can then useSHOW_CREATE_TABLEto view information on the table for the exported model.mysql> CALL sys.ML_MODEL_EXPORT(@iris_model, 'ML_SCHEMA_user1.model_export'); Query OK, 0 rows affected (0.06 sec) mysql> SHOW CREATE TABLE ML_SCHEMA_user1.model_export; +--------------+--------------------------------------------------------------------+ | Table | Create Table | +--------------+--------------------------------------------------------------------+ | model_export | CREATE TABLE `model_export` ( `chunk_id` int NOT NULL AUTO_INCREMENT, `model_object` longtext, `model_metadata` json DEFAULT NULL, PRIMARY KEY (`chunk_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci | +--------------+--------------------------------------------------------------------+ 1 row in set (0.00 sec)