Teradata Package for Python Function Reference | 17.10 - list_byom - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference
- Product
- Teradata Package for Python
- Release Number
- 17.10
- Published
- April 2022
- Language
- English (United States)
- Last Update
- 2022-08-19
- lifecycle
- previous
- Product Category
- Teradata Vantage
- teradataml.catalog.byom.list_byom = list_byom(table_name=None, schema_name=None, model_id=None)
- DESCRIPTION:
Function to list models.
PARAMETERS:
table_name:
Optional Argument.
Specifies the name of the table to list models from.
Notes:
* One must either specify this argument or set the byom model catalog table
name using set_byom_catalog().
* If none of these arguments are set, exception is raised; If both arguments
are set, the settings in list_byom() take precedence and is used for
function execution when saving an model.
Types: str
schema_name:
Optional Argument.
Specifies the name of the schema/database in which the table specified in
"table_name" is looked up.
Notes:
* One must either specify this argument and table_name argument
or set the byom model catalog schema and table name using set_byom_catalog().
* If none of these arguments are set, exception is raised; If both arguments
are set, the settings in list_byom() take precedence and is used for
function execution when saving an model.
* If user specifies schema_name argument table_name argument has to be specified,
else exception is raised.
Types: str
model_id:
Optional Argument.
Specifies the unique model identifier of the model(s). If specified,
the models with either exact match or a substring match, are listed.
Types: str OR list
RETURNS:
None.
RAISES:
TeradataMlException, TypeError
EXAMPLES:
>>> import teradataml, os, datetime
>>> model_file = os.path.join(os.path.dirname(teradataml.__file__), 'data', 'models', 'iris_kmeans_model')
>>> from teradataml import save_byom, list_byom
>>> 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.
>>> save_byom('iris_model1', model_file, 'byom_licensed_models')
Model is saved.
>>>
# Example 1 - List all the models from the table byom_models.
>>> list_byom(table_name='byom_models')
model
model_id
model7 b'504B03041400080808...'
iris_model1 b'504B03041400080808...'
>>>
# Example 2 - List all the models with model_id containing 'iris' string.
# List such models from 'byom_models' table.
>>> list_byom(table_name='byom_models', model_id='iris')
model
model_id
iris_model1 b'504B03041400080808...'
>>>
# Example 3 - List all the models with model_id containing either 'iris'
# or '7'. List such models from '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 the models from the 'byom_models' table and table is
# in 'test' DataBase.
>>> list_byom(table_name='byom_models', schema_name='test')
model
model_id
model8 b'504B03041400080808...'
>>>
# Example 5 - List all the models from the model cataloging table
# set by set_byom_catalog().
>>> set_byom_catalog(table_name='byom_models', schema_name='alice')
The model cataloging parameters are set to table_name='byom_models' and schema_name='alice'
>>> list_byom()
model
model_id
model8 b'504B03041400080808...'
# Example 6 - List all the models from the table other than model cataloging table
# set at the session level.
>>> set_byom_catalog(table_name='byom_models', schema_name= alice')
The model cataloging parameters are set to table_name='byom_models' and schema_name='alice'
>>> list_byom(table_name='byom_licensed_models')
model
model_id
iris_model1 b'504B03041400080808...'