:mod:`airflow.contrib.hooks.wasb_hook` ====================================== .. py:module:: airflow.contrib.hooks.wasb_hook Module Contents --------------- .. py:class:: WasbHook(wasb_conn_id='wasb_default') Bases::class:`airflow.hooks.base_hook.BaseHook` Interacts with Azure Blob Storage through the wasb:// protocol. Additional options passed in the 'extra' field of the connection will be passed to the `BlockBlockService()` constructor. For example, authenticate using a SAS token by adding {"sas_token": "YOUR_TOKEN"}. :param wasb_conn_id: Reference to the wasb connection. :type wasb_conn_id: str .. method:: get_conn(self) Return the BlockBlobService object. .. method:: check_for_blob(self, container_name, blob_name, **kwargs) Check if a blob exists on Azure Blob Storage. :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param kwargs: Optional keyword arguments that `BlockBlobService.exists()` takes. :type kwargs: object :return: True if the blob exists, False otherwise. :rtype: bool .. method:: check_for_prefix(self, container_name, prefix, **kwargs) Check if a prefix exists on Azure Blob storage. :param container_name: Name of the container. :type container_name: str :param prefix: Prefix of the blob. :type prefix: str :param kwargs: Optional keyword arguments that `BlockBlobService.list_blobs()` takes. :type kwargs: object :return: True if blobs matching the prefix exist, False otherwise. :rtype: bool .. method:: load_file(self, file_path, container_name, blob_name, **kwargs) Upload a file to Azure Blob Storage. :param file_path: Path to the file to load. :type file_path: str :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param kwargs: Optional keyword arguments that `BlockBlobService.create_blob_from_path()` takes. :type kwargs: object .. method:: load_string(self, string_data, container_name, blob_name, **kwargs) Upload a string to Azure Blob Storage. :param string_data: String to load. :type string_data: str :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param kwargs: Optional keyword arguments that `BlockBlobService.create_blob_from_text()` takes. :type kwargs: object .. method:: get_file(self, file_path, container_name, blob_name, **kwargs) Download a file from Azure Blob Storage. :param file_path: Path to the file to download. :type file_path: str :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param kwargs: Optional keyword arguments that `BlockBlobService.create_blob_from_path()` takes. :type kwargs: object .. method:: read_file(self, container_name, blob_name, **kwargs) Read a file from Azure Blob Storage and return as a string. :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param kwargs: Optional keyword arguments that `BlockBlobService.create_blob_from_path()` takes. :type kwargs: object .. method:: delete_file(self, container_name, blob_name, is_prefix=False, ignore_if_missing=False, **kwargs) Delete a file from Azure Blob Storage. :param container_name: Name of the container. :type container_name: str :param blob_name: Name of the blob. :type blob_name: str :param is_prefix: If blob_name is a prefix, delete all matching files :type is_prefix: bool :param ignore_if_missing: if True, then return success even if the blob does not exist. :type ignore_if_missing: bool :param kwargs: Optional keyword arguments that `BlockBlobService.create_blob_from_path()` takes. :type kwargs: object