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(self, 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(self, 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

abstract get_conn_uri(self, conn_id)[source]

Get conn_uri from Secrets Backend

This method is deprecated and will be removed in a future release; implement get_conn_value instead.

Parameters

conn_id (str) -- connection id

get_connection(self, 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

get_connections(self, conn_id)[source]

Return connection object with a given conn_id.

Parameters

conn_id (str) -- connection id

abstract get_variable(self, key)[source]

Return value for Airflow Variable

Parameters

key (str) -- Variable Key

Returns

Variable Value

Return type

Optional[str]

get_config(self, key)[source]

Return value for Airflow Config Key

Parameters

key (str) -- Config Key

Returns

Config Value

Return type

Optional[str]

Was this entry helpful?