8.4.10 Storing a Trained Pg2vec Model

You can store models in database. The models get stored as a row inside a model store table.

The following code shows how to store a trained Pg2vec model in database in a specific model store table:

opg4j> model.export().db(). 
              modelstore("modelstoretablename").  // name of the model store table
              modelname("model").                 // model name (primary key of model store table)
              description("a model description"). // description to store alongside the model
              store()
model.export().db()
    .modelstore("modelstoretablename")  // name of the model store table
    .modelname("model")                 // model name (primary key of model store table)
    .description("a model description") // description to store alongside the model
    .store();
model.export().db(model_store="modeltablename",            # name of the model store table
                  model_name="model",                      # model name (primary key of model store table)
                  model_description="a model description") # description to store alongside the model

Note:

All the preceding examples assume that you are storing the model in the current logged in database. If you must store the model in a different database then refer to the examples in Storing a Trained Model in Another Database.