airflow.secrets.local_filesystem

與從本機檔案檢索連線和變數相關的物件。

模組內容

類別

LocalFilesystemBackend

從本機檔案檢索連線物件和變數。

函式

get_connection_parameter_names()

傳回 airflow.models.connection.Connection 建構子參數。

load_variables(file_path)

從文字檔載入變數。

load_connections(file_path)

使用 airflow.secrets.local_filesystem.load_connections_dict,此方法已棄用。

load_connections_dict(file_path)

從文字檔載入連線。

屬性

log

FILE_PARSERS

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

傳回 airflow.models.connection.Connection 建構子參數。

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

從文字檔載入變數。

支援 JSONYAML.env 檔案。

參數

file_path (str) – 將被處理的檔案位置。

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

使用 airflow.secrets.local_filesystem.load_connections_dict,此方法已棄用。

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

從文字檔載入連線。

支援 JSONYAML.env 檔案。

傳回

一個字典,其中鍵包含連線 ID,而值包含連線。

回傳類型

dict[str, Any]

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

繼承自: airflow.secrets.base_secrets.BaseSecretsBackendairflow.utils.log.logging_mixin.LoggingMixin

從本機檔案檢索連線物件和變數。

支援 JSONYAML.env 檔案。

參數
  • variables_file_path (str | None) – 包含變數資料的檔案位置。

  • connections_file_path (str | None) – 包含連線資料的檔案位置。

get_connection(conn_id)[source]

傳回具有給定 conn_id 的連線物件。

首先嘗試 get_conn_value,如果未實作,則嘗試 get_conn_uri

參數

conn_id (str) – 連線 ID

get_connections(conn_id)[source]

傳回具有給定 conn_id 的連線物件。

參數

conn_id (str) – 連線 ID

get_variable(key)[source]

傳回 Airflow 變數的值。

參數

key (str) – 變數鍵

傳回

變數值

回傳類型

str | None

這個條目對您有幫助嗎?