Teradata Package for Python Function Reference on VantageCloud Lake - Client - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.08
Published
November 2025
ft:locale
en-US
ft:lastEdition
2025-12-05
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage

 
teradataml.sdk.Client = class Client(builtins.object)
    teradataml.sdk.Client(base_url=None, auth=None, ssl_verify=True, config_file=None)
 

 
  Methods defined here:
__init__(self, base_url=None, auth=None, ssl_verify=True, config_file=None)
DESCRIPTION:
    Initializes the Client object and sets up the configuration for the client.
 
PARAMETERS:
    base_url:
        Optional Argument.
        Specifies the base URL of API endpoint. All requests are made to a relative path to
        this URL. It can be provided directly, or derived from the "BASE_URL" environment
        variable or the YAML configuration variable "base_url". If not provided in any of
        these 3 ways, appropriate Exception is raised.
        Types: str or None
 
    auth:
        Optional Argument.
        Specifies the type of authentication to be used. It can be one of the following
        authentication type objects:
        - ClientCredentialsAuth: For client credentials authentication.
        - DeviceCodeAuth: For device code authentication.
        - BearerAuth: For bearer token authentication.
 
        Authentication mode is property of the auth object that is passed to this argument.
        If this argument is not provided, authentication mode is derived from the
        "BASE_API_AUTH_MODE" environment variable or the YAML configuration variable
        "auth_mode". If this argument and the above 2 (environment variable and YAML
        configuration variable) are not provided, appropriate Exception is raised.
 
        For Authentication modes through environment variables without passing auth
        argument and config file, the following environment variables are used:
        - BASE_URL: Specifies the base URL of API endpoint.
        - BASE_API_AUTH_MODE: Specifies the authentication mode. It can be one of the
          following:
            - "client_credentials": For client credentials authentication.
            - "device_code": For device code authentication.
            - "bearer": For bearer token authentication.
        - BASE_SSL_VERIFY: Similar to 'ssl_verify' argument.
        - BASE_API_AUTH_CLIENT_ID: OAuth2 client ID. Required for "client_credentials" and
            "device_code" authentication modes.
        - BASE_API_AUTH_CLIENT_SECRET: OAuth2 client secret. Required for "client_credentials"
            and "device_code" authentication modes.
        - BASE_API_AUTH_TOKEN_URL: OAuth2 token endpoint. Required for "client_credentials"
            and "device_code" authentication modes.
        - BASE_API_AUTH_DEVICE_AUTH_URL: OAuth2 device code endpoint. Required for
            "device_code" authentication mode.
        - BASE_API_AUTH_BEARER_TOKEN: The raw bearer token. Required for "bearer"
            authentication.
 
        Note:
            - For device_code authentication, token is searched in "~/.teradataml/sdk/.token".
              If it is not present, token is created, used for authentication and saved in
              the same location.
 
        Types: ClientCredentialsAuth, DeviceCodeAuth, BearerAuth or None
 
    ssl_verify:
        Optional Argument.
        Specifies whether to enable or disable TLS Cert validation. If True, TLS cert
        validation is enabled. If False, TLS cert validation is disabled. It can be provided
        directly, or derived from the "BASE_SSL_VERIFY" environment variable or the YAML
        configuration variable "ssl_verify". If ssl_verify is not provided in any of
        these 3 ways, it is set to True by default.
        Default Value: True (Enable TLS cert validation)
        Types: bool or None
 
    config_file:
        Optional Argument.
        Specifies the path to the YAML configuration file.
 
        Note:
            - At least one of YAML config file or environment variables or above arguments
               must be provided. If not provided, appropriate Exception is raised.
            - If config_file is not provided, the default config file
              ~/.teradataml/sdk/config.yaml is used. If the default config file is not
              found, this function tries to read the configuration from the environment
              variables or other arguments.
 
        If YAML file is provided, it should have the following details, depending on the
        what is provided in other arguments:
        - ssl_verify (bool) : Same as ssl_verify argument.
        - base_url (str) : Same as base_url argument.
        - auth_mode (str) : Authentication mode to be used. It can be one of the following:
            - client_credentials: For client credentials authentication.
            - device_code: For device code authentication.
            - bearer: For bearer token authentication.
        - auth_client_id (str) : OAuth2 client ID. Required for client_credentials and
            device_code authentication modes.
        - auth_client_secret (str) : OAuth2 client secret. Required for client_credentials
            and device_code authentication modes.
        - auth_token_url (str) : OAuth2 token endpoint. Required for client_credentials and
            device_code authentication modes.
        - auth_device_auth_url (str) : OAuth2 device code endpoint. Required for device_code
            authentication mode.
        - auth_bearer (str) : The raw bearer token. Required for bearer authentication mode.
 
        Types: str or None
 
RETURNS:
    None
 
RAISES:
    - TeradataMlException: If the base_url, auth_mode, or ssl_verify is not provided in
      any of the 3 ways (YAML config file, environment variables, or constructor arguments).
    - ValueError: If the base_url is not provided in any of the 3 ways.
    - FileNotFoundError: If the specified YAML file does not exist.
    - yaml.YAMLError: If there is an error in parsing the YAML file.
 
EXAMPLES:
    >>> from teradataml.sdk import Client, ClientCredentialsAuth, DeviceCodeAuth
    >>> import os
 
    # Example 1: Using a custom configuration file for client credentials authentication.
    >>> cc_auth_dict = {"auth_client_id": "your_client_id",
                        "auth_client_secret": "your_client_secret",
                        "auth_token_url": "https://example.com/token",
                        "auth_mode": "client_credentials",
                        "base_url": "https://example.com",
                        "ssl_verify": False}
 
    >>> # Write data to config file.
    >>> cc_config_file = "custom_config.yaml"
    >>> import yaml
    >>> with open(cc_config_file, "w") as f:
            yaml.dump(cc_auth_dict, f, sort_keys=False)
    
    >>> # Create client object using config file.
    >>> obj = Client(config_file=cc_config_file)
 
    # Example 2: Using environment variables.
    >>> os.environ["BASE_URL"] = "https://example.com"
    >>> os.environ["BASE_API_AUTH_MODE"] = "client_credentials"
    >>> os.environ["BASE_API_AUTH_CLIENT_ID"] = "your_client_id"
    >>> os.environ["BASE_API_AUTH_CLIENT_SECRET"] = "your_client_secret"
    >>> os.environ["BASE_API_AUTH_TOKEN_URL"] = "https://example.com/token"
    >>> os.environ["BASE_SSL_VERIFY"] = "false"
    >>> obj = Client()
 
    # Example 3: Using constructor arguments.
    >>> obj = Client(
            base_url="https://example.com",
            auth=DeviceCodeAuth(
                auth_client_id="your_client_id",
                auth_client_secret="your_client_secret",
                auth_token_url="https://example.com/token",
                auth_device_auth_url="https://example.com/device_auth"
            ),
            ssl_verify=True
        )
delete_request(self, path, header_params: Dict[str, str], query_params: Dict[str, str], body: Dict[str, str])
DESCRIPTION:
    Sends a DELETE request to the specified API endpoint with the provided body and parameters.
 
PARAMETERS:
    path:
        Required Argument.
        Specifies the URL path for the API endpoint along with path parameters.
        Note:
            It should be a relative path to the base URL.
        Types: str
 
    header_params:
        Required Argument.
        Specifies the header parameters to be included in the request.
        Types: dict
 
    query_params:
        Required Argument.
        Specifies the query parameters to be included in the request.
        Types: dict
 
    body:
        Required Argument.
        Specifies the request body to be sent in the DELETE request.
        Types: dict
 
RETURNS:
    dict for resources if the request is successful, or str for errors.
 
RAISES:
    HTTPError: If the response contains an HTTP error status code.
 
EXAMPLES:
    >>> client = Client(...)
    >>> client.delete_request("/api/projects/123", header_params, query_params, body)
get_request(self, path, header_params: Dict[str, str], query_params: Dict[str, str])
DESCRIPTION:
    Sends a GET request to the specified API endpoint using the provided parameters.
 
PARAMETERS:
    path:
        Required Argument.
        Specifies the URL path for the API endpoint along with path parameters.
        Note:
            It should be a relative path to the base URL.
        Types: str
 
    header_params:
        Required Argument.
        Specifies the header parameters to be included in the request.
        Types: dict
 
    query_params:
        Required Argument.
        Specifies the query parameters to be included in the request.
        Types: dict
 
RETURNS:
    dict for resources if the request is successful, None if resource is not found (404), or str for errors.
 
RAISES:
    TeradatamlRestException: If a network or HTTP error occurs.
    HTTPError: If the response contains an HTTP error status code.
 
EXAMPLES:
    >>> client = Client(...)
    >>> client.get_request("/api/projects", header_params, query_params)
patch_request(self, path, header_params: Dict[str, str], query_params: Dict[str, str], body: Dict[str, str])
DESCRIPTION:
    Sends a PATCH request to the specified API endpoint with the provided body and parameters.
 
PARAMETERS:
    path:
        Required Argument.
        Specifies the URL path for the API endpoint along with path parameters.
        Note:
            It should be a relative path to the base URL.
        Types: str
 
    header_params:
        Required Argument.
        Specifies the header parameters to be included in the request.
        Types: dict
 
    query_params:
        Required Argument.
        Specifies the query parameters to be included in the request.
        Types: dict
 
    body:
        Required Argument.
        Specifies the request body to be sent in the PATCH request.
        Types: dict
 
RETURNS:
    dict for resources if the request is successful, or str for errors.
 
RAISES:
    HTTPError: If the response contains an HTTP error status code.
 
EXAMPLES:
    >>> client = Client(...)
    >>> client.patch_request("/api/projects/123", header_params, query_params, body)
post_request(self, path, header_params: Dict[str, str], query_params: Dict[str, str], body: Dict[str, str])
DESCRIPTION:
    Sends a POST request to the specified API endpoint with the provided body and parameters.
 
PARAMETERS:
    path:
        Required Argument.
        Specifies the URL path for the API endpoint along with path parameters.
        Note:
            It should be a relative path to the base URL.
        Types: str
 
    header_params:
        Required Argument.
        Specifies the header parameters to be included in the request.
        Types: dict
 
    query_params:
        Required Argument.
        Specifies the query parameters to be included in the request.
        Types: dict
 
    body:
        Required Argument.
        Specifies the request body to be sent in the POST request.
        Types: dict
 
RETURNS:
    dict for resources if the request is successful, or str for errors.
 
RAISES:
    HTTPError: If the response contains an HTTP error status code.
 
EXAMPLES:
    >>> client = Client(...)
    >>> client.post_request("/api/projects", header_params, query_params, body)
put_request(self, path, header_params: Dict[str, str], query_params: Dict[str, str], body: Dict[str, str])
DESCRIPTION:
    Sends a PUT request to the specified API endpoint with the provided body and parameters.
 
PARAMETERS:
    path:
        Required Argument.
        Specifies the URL path for the API endpoint along with path parameters.
        Note:
            It should be a relative path to the base URL.
        Types: str
 
    header_params:
        Required Argument.
        Specifies the header parameters to be included in the request.
        Types: dict
 
    query_params:
        Required Argument.
        Specifies the query parameters to be included in the request.
        Types: dict
 
    body:
        Required Argument.
        Specifies the request body to be sent in the PUT request.
        Types: dict
 
RETURNS:
    dict for resources if the request is successful, or str for errors.
 
RAISES:
    HTTPError: If the response contains an HTTP error status code.
 
EXAMPLES:
    >>> client = Client(...)
    >>> client.put_request("/api/projects/123", header_params, query_params, body)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
DEFAULT_CONFIG_DIR = r'~\.teradataml\.sdk'
DEFAULT_CONFIG_FILE_PATH = r'~\.teradataml\.sdk\config.yaml'
DEFAULT_TOKEN_CACHE_FILE_PATH = r'~\.teradataml\.sdk\.token'
MAX_RETRIES = 3
SDK_NAME = 'BaseSDK'