:mod:`airflow.contrib.hooks.azure_fileshare_hook` ================================================= .. py:module:: airflow.contrib.hooks.azure_fileshare_hook Module Contents --------------- .. py:class:: AzureFileShareHook(wasb_conn_id='wasb_default') Bases::class:`airflow.hooks.base_hook.BaseHook` Interacts with Azure FileShare Storage. Additional options passed in the 'extra' field of the connection will be passed to the `FileService()` constructor. :param wasb_conn_id: Reference to the wasb connection. :type wasb_conn_id: str .. method:: get_conn(self) Return the FileService object. .. method:: check_for_directory(self, share_name, directory_name, **kwargs) Check if a directory exists on Azure File Share. :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param kwargs: Optional keyword arguments that `FileService.exists()` takes. :type kwargs: object :return: True if the file exists, False otherwise. :rtype: bool .. method:: check_for_file(self, share_name, directory_name, file_name, **kwargs) Check if a file exists on Azure File Share. :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param kwargs: Optional keyword arguments that `FileService.exists()` takes. :type kwargs: object :return: True if the file exists, False otherwise. :rtype: bool .. method:: list_directories_and_files(self, share_name, directory_name=None, **kwargs) Return the list of directories and files stored on a Azure File Share. :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param kwargs: Optional keyword arguments that `FileService.list_directories_and_files()` takes. :type kwargs: object :return: A list of files and directories :rtype: list .. method:: create_directory(self, share_name, directory_name, **kwargs) Create a new directory on a Azure File Share. :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param kwargs: Optional keyword arguments that `FileService.create_directory()` takes. :type kwargs: object :return: A list of files and directories :rtype: list .. method:: get_file(self, file_path, share_name, directory_name, file_name, **kwargs) Download a file from Azure File Share. :param file_path: Where to store the file. :type file_path: str :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param kwargs: Optional keyword arguments that `FileService.get_file_to_path()` takes. :type kwargs: object .. method:: get_file_to_stream(self, stream, share_name, directory_name, file_name, **kwargs) Download a file from Azure File Share. :param stream: A filehandle to store the file to. :type stream: file-like object :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param kwargs: Optional keyword arguments that `FileService.get_file_to_stream()` takes. :type kwargs: object .. method:: load_file(self, file_path, share_name, directory_name, file_name, **kwargs) Upload a file to Azure File Share. :param file_path: Path to the file to load. :type file_path: str :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param kwargs: Optional keyword arguments that `FileService.create_file_from_path()` takes. :type kwargs: object .. method:: load_string(self, string_data, share_name, directory_name, file_name, **kwargs) Upload a string to Azure File Share. :param string_data: String to load. :type string_data: str :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param kwargs: Optional keyword arguments that `FileService.create_file_from_text()` takes. :type kwargs: object .. method:: load_stream(self, stream, share_name, directory_name, file_name, count, **kwargs) Upload a stream to Azure File Share. :param stream: Opened file/stream to upload as the file content. :type stream: file-like :param share_name: Name of the share. :type share_name: str :param directory_name: Name of the directory. :type directory_name: str :param file_name: Name of the file. :type file_name: str :param count: Size of the stream in bytes :type count: int :param kwargs: Optional keyword arguments that `FileService.create_file_from_stream()` takes. :type kwargs: object