load_example_data() Function - Teradata Python Package

Teradata® Python Package User Guide

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-29
dita:mapPath
rkb1531260709148.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

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")