airflow.providers.microsoft.azure.hooks.fileshare

AzureFileShareHook

與 Azure 檔案共享儲存互動。

模組內容

class airflow.providers.microsoft.azure.hooks.fileshare.AzureFileShareHook(share_name=None, file_path=None, directory_path=None, azure_fileshare_conn_id='azure_fileshare_default')[source]

基類: airflow.hooks.base.BaseHook

與 Azure 檔案共享儲存互動。

引數:

azure_fileshare_conn_id (str) – 引用要使用的 Azure 帳戶的 Azure 檔案共享連線 ID

conn_name_attr = 'azure_fileshare_conn_id'[source]
default_conn_name = 'azure_fileshare_default'[source]
conn_type = 'azure_fileshare'[source]
hook_name = 'Azure FileShare'[source]
classmethod get_connection_form_widgets()[source]

返回新增到連線表單的連線小部件。

classmethod get_ui_field_behaviour()[source]

返回自定義欄位行為。

share_name = None[source]
file_path = None[source]
directory_path = None[source]
get_conn()[source]

返回 hook 的連線。

property share_service_client[source]
property share_directory_client[source]
property share_file_client[source]
check_for_directory()[source]

檢查 Azure 檔案共享上是否存在目錄。

list_directories_and_files()[source]

返回儲存在 Azure 檔案共享上的目錄和檔案列表。

list_files()[source]

返回儲存在 Azure 檔案共享上的檔案列表。

create_share(share_name, **kwargs)[source]

建立新的 Azure 檔案共享。

引數:

share_name (str) – 共享名稱。

返回:

如果共享已建立則返回 True,如果共享已存在則返回 False。

返回型別:

bool

delete_share(share_name, **kwargs)[source]

刪除現有的 Azure 檔案共享。

引數:

share_name (str) – 共享名稱。

返回:

如果共享已刪除則返回 True,如果共享不存在則返回 False。

返回型別:

bool

create_directory(**kwargs)[source]

在 Azure 檔案共享上建立新目錄。

get_file(file_path, **kwargs)[source]

從 Azure 檔案共享下載檔案。

引數:

file_path (str) – 儲存檔案的路徑。

get_file_to_stream(stream, **kwargs)[source]

從 Azure 檔案共享下載檔案。

引數:

stream (IO) – 用於儲存檔案的檔案控制代碼。

load_file(file_path, **kwargs)[source]

上傳檔案到 Azure 檔案共享。

引數:

file_path (str) – 要載入的檔案的路徑。

load_data(string_data, **kwargs)[source]

上傳字串到 Azure 檔案共享。

引數:

string_data (bytes | str | IO) – 要載入的字串/流。

test_connection()[source]

測試 Azure 檔案共享連線。

此條目有幫助嗎?