airflow.secrets.base_secrets

Module Contents

Classes

BaseSecretsBackend

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

class airflow.secrets.base_secrets.BaseSecretsBackend[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, secret_id, sep='/')[source]

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: “/”

abstract get_conn_value(conn_id)[source]

Retrieve from Secrets Backend a string value representing the Connection object.

If the client your secrets backend uses already returns a python dict, you should override get_connection instead.

Parameters

conn_id (str) – connection id

deserialize_connection(conn_id, value)[source]

Given a serialized representation of the airflow Connection, return an instance.

Looks at first character to determine how to deserialize.

Parameters
  • conn_id (str) – connection id

  • value (str) – the serialized representation of the Connection object

Returns

the deserialized Connection

Return type

airflow.models.connection.Connection

get_connection(conn_id)[source]

Return connection object with a given conn_id.

Tries get_conn_value first and if not implemented, tries get_conn_uri

Parameters

conn_id (str) – connection id

abstract get_variable(key)[source]

Return value for Airflow Variable.

Parameters

key (str) – Variable Key

Returns

Variable Value

Return type

str | None

get_config(key)[source]

Return value for Airflow Config Key.

Parameters

key (str) – Config Key

Returns

Config Value

Return type

str | None

Was this entry helpful?