TDApiClient.API_Request is a static helper function to invoke the in-database function API_Request.
This function returns a teradataml DataFrame.
- 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 = ('{{ "key": ' + '"{}", "region" : "{}"}}')
auth_info = auth_info_fmt_str.format(access_key, azure_region)
df = TDApiClient.API_Request(
reviews_df,
"azure-ml",
authorization=auth_info,
endpoint='test-azure-ml-endpoint',
content_type="csv"
)