airflow.secrets

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

  • Environment variables

  • Metatsore database

  • AWS SSM Parameter store

Package Contents

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

Abstract base class to retrieve secrets given a conn_id and construct a Connection object

__metaclass__
static build_path(path_prefix, secret_id, sep='/')

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)

Get conn_uri from Secrets Backend

Parameters

conn_id (str) – connection id

get_connections(self, conn_id)

Get connections with a specific ID

Parameters

conn_id (str) – connection id

get_variable(self, key)

Return value for Airflow Connection

Parameters

key – Variable Key

Returns

Variable Value

airflow.secrets.get_connections(conn_id) → List[Connection][source]
Get all connections as an iterable.
Parameters

conn_id – connection id

Returns

array of connections

airflow.secrets.get_variable(key) → Optional[str][source]
Get Airflow Variable by iterating over all Secret Backends.
Parameters

key – Variable Key

Returns

Variable Value

Was this entry helpful?