TDApiClient.API_Request is a static helper function to invoke the in-database function API_Request.
This function returns a teradataml DataFrame.
Required Arguments:
- dataframe: Specifies an input teradataml DataFrame which will act as the input query for the API_Request in-database function.
Optional Arguments:
- options: Specifies key-value arguments to be passed to the in-database function API_Request. See list of these key-value arguments in the following table.
The following table shows the mapping between TDApiClient.API_Request arguments to the corresponding parameters in the in-database function API_Request. For details of these parameters, see API_Request In-database Function Syntax Elements.
| TDApiClient.API_Request Argument | Required or Optional | API_Request in-database function Parameter |
|---|---|---|
| api_type | Required | API_TYPE |
| authorization | Required | AUTHORIZATION |
| content_type | Optional | CONTENT_TYPE |
| key_start_index | Optional | KEY_START_INDEX |
| endpoint | Optional | ENDPOINT |
Example
from TDApiClient import TDApiClient
auth_info_fmt_str = ('{{ "Access_ID": "{}", "Access_Key": '
+ '"{}", "Region" : "{}"}}')
auth_info = auth_info_fmt_str.format(access_id, access_key,
aws_region)
df = TDApiClient.API_Request(reviews_df, "aws-sagemaker",
authorization=auth_info,
endpoint='td-sagemaker-xgboost',
key_start_index=1)