The load_example_data() is a helper function that loads the sample datasets.
The Teradata Python package offers various API's and each API provides some examples for you. To test these examples, you need the sample datasets loaded in Vantage.
The load_example_data() function can only be used in a restricted way. Function arguments can only accept predetermined values as listed here and shown in the following example.
-
function_name
This required argument contains the prefix name of the example JSON file to be used to load data.
You must specify the function_name values as specified in the example sections of corresponding teradataml API's. If any other string is passed as prefix input, an error will be raised as 'prefix_str_example.json' file not found. This *_example.json file contains the schema information for the tables that can be loaded using this JSON file. -
table_name
This required argument specifies the name(s) of the table to be created in the database.
Table names provided here must have an equivalent datafile (CSV) present at teradataml/data. Schema information for the same must also be present in <function_name>_example.json as shown in 'function_name' argument description.
- The function creates a new table in Vantage with the name specified in the table_name argument. You must manually drop the table if required.
- If a table with the name provided for table_name argument already exists, this function will skip creation and loading of the dataset.
Usage Example
from teradataml import load_example_data load_example_data("dataframe","sales")