airflow.secrets.local_filesystem

Objects relating to retrieving connections and variables from local file

Module Contents

airflow.secrets.local_filesystem.log[source]
airflow.secrets.local_filesystem.get_connection_parameter_names()[source]
Returns :class:`airflow.models.connection.Connection` constructor parameters.
airflow.secrets.local_filesystem._parse_env_file(file_path)[source]
Parse a file in the ``.env '' format.
    MY_CONN_ID=my-conn-type://my-login:my-pa%2Fssword@my-host:5432/my-schema?param1=val1&param2=val2

:param file_path: The location of the file that will be processed.
:type file_path: str
:return: Tuple with mapping of key and list of values and list of syntax errors
airflow.secrets.local_filesystem._parse_json_file(file_path)[source]
Parse a file in the JSON format.
Parameters

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

Returns

Tuple with mapping of key and list of values and list of syntax errors

airflow.secrets.local_filesystem.FILE_PARSERS[source]
airflow.secrets.local_filesystem._parse_secret_file(file_path)[source]
Based on the file extension format, selects a parser, and parses the file.
Parameters

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

Returns

Map of secret key (e.g. connection ID) and value.

airflow.secrets.local_filesystem._create_connection(conn_id, value)[source]
Creates a connection based on a URL or JSON object.
airflow.secrets.local_filesystem.load_variables(file_path)[source]
Load variables from a text file.
Both ``JSON`` 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]
Load connection from text file.
Both ``JSON`` and ``.env`` files are supported.
Returns

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

Return type

list[str, list[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 Both JSON and .env files are supported.

Parameters
  • variables_file_path (str) – File location with variables data.

  • connections_file_path (str) – File location with connection data.

_local_variables[source]
_local_connections[source]
get_connections(self, conn_id)[source]
get_variable(self, key)[source]

Was this entry helpful?