list_byom() | Teradata Package for Python - list_byom() - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2022-01-14
dita:mapPath
bol1585763678431.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

The list_byom() API allows a user to list saved models, filtering the results based on the optional arguments.

Required Argument:
  • table_name specifies the name of the table to list models from.
Optional Arguments:
  • schema_name specifies the name of the schema in which the table specified in table_name is looked up.

    If not specified, then table is looked up in current schema.

  • model_id specifies the unique model identifier of the model(s).

    If specified, the models with either exact match or a substring match, are listed.

Example Setup

  • Import necessary modules.
    >>> import teradataml, os, datetime
    >>> from teradataml import save_byom, list_byom
  • Get the model file path.
    >>> model_file = os.path.join(os.path.dirname(teradataml.__file__), "data", "models", "iris_kmeans_model")
  • Save some models with different parameters.
    >>> save_byom("model7", model_file, "byom_models")
    Model is saved.
    >>> save_byom("iris_model1", model_file, "byom_models")
    Model is saved.
    >>> save_byom("model8", model_file, "byom_models", schema_name="test")
    Model is saved.

Example 1: List all models in a table

This example lists all the models saved in the table "byom_models".

>>> list_byom(table_name="byom_models")
                                model
model_id
model7       b'504B03041400080808...'
iris_model1  b'504B03041400080808...'

Example 2: List all models with model_id containing a specific string

This example lists all the models with model_id containing the string "iris", from the "byom_models" table.

>>> list_byom(table_name="byom_models", model_id="iris")
                                model
model_id
iris_model1  b'504B03041400080808...'

Example 3: List all models with model_id containing one of the two strings

This example lists all the models with model_id containing either "iris" or "7" string, from the "byom_models" table.

>>> list_byom(table_name="byom_models", model_id=["iris", "7"])
                                model
model_id
model7       b'504B03041400080808...'
iris_model1  b'504B03041400080808...'

Example 4: List all models in a table in the specified database

This example lists all the models from the "byom_models" in the "test" database.

>>> list_byom(table_name="byom_models", schema_name="test")
                                model
model_id
model8       b'504B03041400080808...'