Client Config

class gretel_client.config.ClientConfig(endpoint: Optional[str] = None, api_key: Optional[str] = None, default_project_name: Optional[str] = None, default_runner: str = 'cloud')

Holds Gretel client configuration details. This can be instantiated from a file or environment.

api_key: Optional[str] = None

Gretel API key.

default_project_name: Optional[str] = None

Default Gretel project name.

default_runner: str = 'cloud'

Default runner

endpoint: str = None

Gretel API endpoint.

get_api(api_interface: Type[T], max_retry_attempts: int = 5, backoff_factor: float = 1) → T

Instantiates and configures an api client for a given component interface.

Parameters
  • api_interface – The api interface to instantiate

  • max_retry_attempts – The number of times to retry a failed api request.

  • backoff_factor – A back factor to apply between retry attempts. A base factor of 2 will applied to this value to determine the time between attempts.

property masked

Returns a masked representation of the config object.

update_default_project(project_id: str)

Updates the default project.

Parameters

project_name – The name or id of the project to set.

gretel_client.config.DEFAULT_GRETEL_ENDPOINT = 'https://api.gretel.cloud'

Default gretel endpoint

gretel_client.config.GRETEL = 'gretel'

Gretel application name

gretel_client.config.GRETEL_API_KEY = 'GRETEL_API_KEY'

Env variable to configure Gretel api key.

gretel_client.config.GRETEL_CONFIG_FILE = 'GRETEL_CONFIG_FILE'

Env variable name to override default configuration file location

gretel_client.config.GRETEL_ENDPOINT = 'GRETEL_ENDPOINT'

Env variable name to configure default Gretel endpoint. Defaults to DEFAULT_GRETEL_ENDPOINT.

gretel_client.config.GRETEL_PROJECT = 'GRETEL_PROJECT'

Env variable name to select default project

exception gretel_client.config.GretelClientConfigurationError
class gretel_client.config.RunnerMode

An enumeration.

gretel_client.config.configure_session(config: Union[str, gretel_client.config.ClientConfig])

Updates client config for the session

Parameters

config – The config to update. If the config is a string, this function will attempt to parse it as a Gretel URI.

gretel_client.config.get_session_config()gretel_client.config.ClientConfig

Return the session’s client config

gretel_client.config.write_config(config: gretel_client.config.ClientConfig, config_path: Union[str, pathlib.Path, None] = None) → pathlib.Path

Writes a Gretel client config to disk.

Parameters
  • config – The client config to write

  • config_path – Path to write the config to. If not path is provided, the default $HOME/.gretel/config.json path is used.