publish_model() | Teradata Python Package - 17.00 - publish_model() - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Release Date
November 2021
Content Type
User Guide
Publication ID
B700-4006-070K
Language
English (United States)

Use the publish_model() function to set the access level of a saved model in the catalog, along with the status of the model.

For example, the status of a model can be 'In-Development' when the model is being fine tuned. Once it is tested, it can be set to 'Active' or 'Production'.

The required argument name specifies the name of the model to be published.

At lease one of the following two optional arguments must specified:
  • grantee: specifies a user or role to update the model's access level to one of the following:
    • Private

      When a model is saved using the save_model() function, the access is set to 'Private'.

    • Public

      A user can set the access level to Public by passing 'PUBLIC' as the value to the grantee argument.

    • Team

      The access level is set to Team when the user passes a user or a role other than PUBLIC, or his or her own username to the grantee argument.

    Currently,
    • The publish_model() function allows the setting of access level only when the current access level is 'Private', and setting to 'Private' from any other access level is not supported.
    • When setting a grantee (or access level), the publish_model() function shows the user which model tables need to be granted access to the grantee. Once these SQL GRANT commands are issued, the model becomes accessible to the intended user(s).
  • status: specifies a string to set the status of the model to one of the following permitted values:
    • Active
    • Retired
    • Candidate
    • Production
    • In-Development
A model can only be published by its creator.

Example Prerequisites

Follow the steps in save_model() to create a classification tree model that can be input to DecisionForestPredict and save the generated model.

Example: Update only the access.

Use describe_model() function to check the update.

>>> publish_model('decision_forest_model', grantee='john')
Model published successfully!
Please execute the following GRANT statements:
GRANT SELECT ON "ALICE"."ml__td_decisionforest0_1589787736719763" to john;
GRANT SELECT ON "ALICE"."ml__td_decisionforest1_1589794611679956" to john;
GRANT SELECT ON "ALICE"."ml__td_sqlmr_out__1589787498246673" to john;
 

To make sure 'John' can access this model's information, you must issue the SQL GRANT statements as suggested in the output message.

Example: Update only the status.

Use describe_model() function to check the update.

>>> publish_model('decision_forest_model', status='Active')
Model published successfully!

Example: Update both the access and status.

Use describe_model() function to check the update.

>>> publish_model('decision_forest_model', grantee='PUBLIC', status='Production')
Model published successfully!
Please execute the following GRANT statements:
GRANT SELECT ON "ALICE"."ml__td_decisionforest0_1589787736719763" to PUBLIC;
GRANT SELECT ON "ALICE"."ml__td_decisionforest1_1589794611679956" to PUBLIC;
GRANT SELECT ON "ALICE"."ml__td_sqlmr_out__1589787498246673" to PUBLIC;
 

To make sure the role 'PUBLIC' can access this model's information, you must issue the SQL GRANT statements as suggested in the output message.