airflow.secrets.local_filesystem

Objects relating to retrieving connections and variables from local file

Module Contents

Classes

LocalFilesystemBackend

Retrieves Connection objects and Variables from local files

Functions

get_connection_parameter_names()

Returns airflow.models.connection.Connection constructor parameters.

load_variables(file_path)

Load variables from a text file.

load_connections(file_path)

This function is deprecated. Please use airflow.secrets.local_filesystem.load_connections_dict.",

load_connections_dict(file_path)

Load connection from text file.

Attributes

log

FILE_PARSERS

airflow.secrets.local_filesystem.log[source]
airflow.secrets.local_filesystem.get_connection_parameter_names()[source]

Returns airflow.models.connection.Connection constructor parameters.

airflow.secrets.local_filesystem.FILE_PARSERS[source]
airflow.secrets.local_filesystem.load_variables(file_path)[source]

Load variables from a text file.

JSON, YAML and .env files are supported.

Parameters

file_path (str) -- The location of the file that will be processed.

Return type

Dict[str, List[str]]

airflow.secrets.local_filesystem.load_connections(file_path)[source]

This function is deprecated. Please use airflow.secrets.local_filesystem.load_connections_dict.",

airflow.secrets.local_filesystem.load_connections_dict(file_path)[source]

Load connection from text file.

JSON, YAML and .env files are supported.

Returns

A dictionary where the key contains a connection ID and the value contains the connection.

Return type

Dict[str, airflow.models.connection.Connection]

class airflow.secrets.local_filesystem.LocalFilesystemBackend(variables_file_path=None, connections_file_path=None)[source]

Bases: airflow.secrets.base_secrets.BaseSecretsBackend, airflow.utils.log.logging_mixin.LoggingMixin

Retrieves Connection objects and Variables from local files

JSON, YAML and .env files are supported.

Parameters
  • variables_file_path (Optional[str]) -- File location with variables data.

  • connections_file_path (Optional[str]) -- File location with connection data.

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

get_variable(self, key)[source]

Return value for Airflow Variable

Parameters

key (str) -- Variable Key

Returns

Variable Value

Return type

Optional[str]

Was this entry helpful?