airflow.secrets

Secrets framework provides means of getting connection objects from various sources, e.g. the following:

  • Environment variables

  • Metastore database

  • AWS SSM Parameter store

Package Contents

class airflow.secrets.BaseSecretsBackend(**kwargs)[source]

Bases: abc.ABC

Abstract base class to retrieve Connection object given a conn_id or Variable given a key

static build_path(path_prefix: str, secret_id: str, sep: str = '/')

Given conn_id, build path for Secrets Backend

Parameters
  • path_prefix (str) – Prefix of the path to get secret

  • secret_id (str) – Secret id

  • sep (str) – separator used to concatenate connections_prefix and conn_id. Default: “/”

get_conn_uri(self, conn_id: str)

Get conn_uri from Secrets Backend

Parameters

conn_id (str) – connection id

get_connection(self, conn_id: str)

Return connection object with a given conn_id.

Parameters

conn_id (str) – connection id

get_connections(self, conn_id: str)

Return connection object with a given conn_id.

Parameters

conn_id (str) – connection id

get_variable(self, key: str)

Return value for Airflow Variable

Parameters

key (str) – Variable Key

Returns

Variable Value

get_config(self, key: str)

Return value for Airflow Config Key

Parameters

key – Config Key

Returns

Config Value

airflow.secrets.DEFAULT_SECRETS_SEARCH_PATH = ['airflow.secrets.environment_variables.EnvironmentVariablesBackend', 'airflow.secrets.metastore.MetastoreBackend'][source]

Was this entry helpful?