Access Azure Blobs and Data Lake Storage (ADLS) Gen2 with fsspec and dask
Maintained. Last release 4 months ago, commits in 5 of the last 26 weeks. Weaker on commit activity.
pip install adlfsFilesystem interface to Azure Blob and Data Lake Storage (Gen2)
Quickstart
This package can be installed using:
pip install adlfs
or
conda install -c conda-forge adlfs
The az:// and abfs:// protocols are included in fsspec's known_implementations registry.
To connect to Azure Blob Storage or Azure Data Lake Storage (ADLS) Gen2 filesystem you can use the protocol abfs or az:
import dask.dataframe as dd
storage_options={'account_name': ACCOUNT_NAME, 'account_key': ACCOUNT_KEY}
ddf = dd.read_csv('abfs://{CONTAINER}/{FOLDER}/*.csv', storage_options=storage_options)
ddf = dd.read_parquet('az://{CONTAINER}/folder.parquet', storage_options=storage_options)
Accepted protocol / uri formats include:
'PROTOCOL://container/path-part/file'
'PROTOCOL://container@account.blob.core.windows.net/path-part/file'
'PROTOCOL://container@account.dfs.core.windows.net/path-part/file'
or optionally, if AZURE_STORAGE_ACCOUNT_NAME and an AZURE_STORAGE_<CREDENTIAL> is
set as an environmental variable, then storage_options will be read from the environmental
variables
To read from a public storage blob you are required to specify the 'account_name'.
For example, you can access NYC Taxi & Limousine Commission as:
storage_options = {'account_name': 'azureopendatastorage'}
ddf = dd.read_parquet('az://nyctlc/green/puYear=2019/puMonth=*/*.parquet', storage_options=storage_options)
Details
The package includes pythonic filesystem implementations for both Azure Blobs and Azure Datalake Gen2 (ADLS), that facilitate interactions between these implementations and Dask. This is done leveraging the base class and Azure Python SDKs.