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', preview_features: str = 'disabled')

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.

  • 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.

preview_features: str = 'disabled'

Preview features enabled

update_default_project(project_id: str)

Updates the default project.


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

gretel_client.config.DEFAULT_GRETEL_ENDPOINT = ''

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.


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.


Env variable to manage preview features

gretel_client.config.GRETEL_PROJECT = 'GRETEL_PROJECT'

Env variable name to select default project

exception gretel_client.config.GretelClientConfigurationError
class gretel_client.config.PreviewFeatures

Manage preview feature configurations

class gretel_client.config.RunnerMode

An enumeration.


Removes any Gretel configuration files from the host file system.

If any Gretel related environment variables exist, this will also remove them from the current processes.

gretel_client.config.configure_session(config: Union[str, gretel_client.config.ClientConfig, None] = None, *, api_key: Optional[str] = None, endpoint: Optional[str] = None, cache: str = 'no', validate: bool = False, clear: bool = False)

Updates client config for the session

  • config – The config to update. This config takes precedence over other parameters such as api_key or endpoint.

  • api_key – Configures your Gretel API key. If api_key is set to “prompt” and no Api Key is found on the system, getpass will be used to prompt for the key.

  • endpoint – Specifies the Gretel API endpoint. This must be a fully qualified URL.

  • cache – Valid options include “yes” and “no”. If cache is “no” the session configuration will not be written to disk. If cache is “yes”, session configuration will be written to disk only if a configuration doesn’t exist.

  • validate – If set to True this will check that login credentials are valid.

  • clear – If set to True any existing Gretel credentials will be removed from the host.


GretelClientConfigurationError if validate=True and credentials – are invalid.


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.

  • 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.