ModelManager
Helper class to manage trained and registered models.
Parameters
Section titled “Parameters”| Name | Type | Description | Optional |
|---|---|---|---|
connector | SnowflakeConnector | The connector object used for sending requests to the GNN engine. | No |
Returns
Section titled “Returns”An instance of the ModelManager class.
Example
Section titled “Example”from relationalai_gnns import ModelManagermodel_manager = ModelManager(connector =connector)Methods
Section titled “Methods”list_models()
Section titled “list_models()”Lists all models that have been trained and registered.
Returns:
A dictionary containing:
Example:
from relationalai_gnns import ModelManager
model_manager = ModelManager()model_manager.list_models()delete_model()
Section titled “delete_model()”Permanently deletes a trained model from the RelationalAI application stage.
Parameters:
| Name | Type | Description | Optional |
|---|---|---|---|
model_run_id | str | Unique identifier of the trained model run. | No |
Example:
from relationalai_gnns import ModelManager
model_manager = ModelManager()model_manager.delete_model( model_run_id="abc123")register_model()
Section titled “register_model()”Registers a trained model in the Snowflake Model Registry.
The model is stored under the specified name and version in the database and schema where the tracker has permissions.
Registration is only allowed if a valid model_run_id exists.
Duplicate version names for a model are not allowed.
⚠️ Note: Ensure the native app has the necessary permissions to the specified database and schema.
-- Grant access to resources needed to register a model in Snowflake.
GRANT USAGE ON DATABASE <DATABASE> TO APPLICATION RELATIONALAI;GRANT USAGE ON SCHEMA <DATABASE>.<SCHEMA> TO APPLICATION RELATIONALAI;GRANT CREATE MODEL ON SCHEMA <DATABASE>.<SCHEMA> TO APPLICATION RELATIONALAI;Parameters:
| Name | Type | Description | Optional |
|---|---|---|---|
model_run_id | str | Unique identifier of the trained model run. | No |
model_name | str | Name to assign to the registered model. | No |
version_name | str | Version name for the model. | No |
database_name | str | Database where the model will be registered. | No |
schema_name | str | Schema in the database where the model will be registered. | No |
comment | str | Optional comment for model registration. | Yes |
Example:
from relationalai_gnns import ModelManager
model_manager = ModelManager()model_manager.register_model( model_run_id=train_job.model_run_id, model_name="new_model", version_name="v3", database_name="database_name", schema_name="schema_name", comment="Production-ready model",)