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.

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.

preview_features: str = 'disabled'

Preview features enabled

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_PREVIEW_FEATURES = 'GRETEL_PREVIEW_FEATURES'

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.

gretel_client.config.clear_gretel_config()

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

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

Raises

GretelClientConfigurationError if validate=True and credentials – are invalid.

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.