New to Claude Skills? Learn how to install them →

sickn33 on GitHub

Azure Data Lake SDK

Free

Efficiently manage big data with Azure's file storage.

Get this skill

Free · Opens the source repo

What Azure Data Lake SDK does

The Azure Data Lake Storage Gen2 SDK for Python provides developers with the tools necessary to handle hierarchical file systems and perform file and directory operations within Azure's cloud environment. It is specifically designed to facilitate big data analytics workloads, enabling seamless integration with existing Python applications. This SDK allows users to create, manage, and manipulate file systems, directories, and files, providing a comprehensive solution for data storage and retrieval in the cloud.

Using the SDK, developers can perform a variety of operations including creating and deleting file systems, uploading and downloading files, and managing directory structures. The SDK supports both synchronous and asynchronous operations, making it suitable for high-throughput scenarios where performance is critical. The authentication mechanism is handled through Azure's identity services, ensuring secure access to storage resources.

This skill is ideal for data engineers, data scientists, and developers who need to work with large datasets in Azure. Whether you're building data pipelines, performing analytics, or simply managing files in the cloud, this SDK simplifies the process and provides a robust set of features to support your needs. With best practices outlined for using hierarchical namespaces and access controls, users can optimize their data management workflows effectively.

Overall, the Azure Data Lake SDK for Python is a powerful tool for anyone looking to leverage Azure's data storage capabilities, offering a straightforward API for complex data operations and ensuring scalability and efficiency in data handling.

When to use it

Use this skill when you need to perform file operations or manage data within Azure Data Lake Storage Gen2.

When not to use it

Avoid this skill for simple file storage needs that do not require hierarchical structures or advanced data management features.

What you can build with it

Data Pipeline Integration

Integrate the Azure Data Lake SDK into your data pipelines to manage large datasets efficiently.

File Management in Cloud Applications

Use the SDK for seamless file uploads, downloads, and directory management in your cloud-based applications.

Big Data Analytics Workflows

Leverage the SDK to handle file operations required for big data analytics, ensuring optimal performance and scalability.

How to install Azure Data Lake SDK

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/azure-storage-file-datalake-py --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

Azure Data Lake Storage Gen2 SDK for Python

Hierarchical file system for big data analytics workloads.

Installation

pip install azure-storage-file-datalake azure-identity

Environment Variables

AZURE_STORAGE_ACCOUNT_URL=https://<account>.dfs.core.windows.net

Authentication

from azure.identity import DefaultAzureCredential
from azure.storage.filedatalake import DataLakeServiceClient

credential = DefaultAzureCredential()
account_url = "https://<account>.dfs.core.windows.net"

service_client = DataLakeServiceClient(account_url=account_url, credential=credential)

Client Hierarchy

ClientPurpose
DataLakeServiceClientAccount-level operations
FileSystemClientContainer (file system) operations
DataLakeDirectoryClientDirectory operations
DataLakeFileClientFile operations

File System Operations

# Create file system (container)
file_system_client = service_client.create_file_system("myfilesystem")

# Get existing
file_system_client = service_client.get_file_system_client("myfilesystem")

# Delete
service_client.delete_file_system("myfilesystem")

# List file systems
for fs in service_client.list_file_systems():
    print(fs.name)

Directory Operations

file_system_client = service_client.get_file_system_client("myfilesystem")

# Create directory
directory_client = file_system_client.create_directory("mydir")

# Create nested directories
directory_client = file_system_client.create_directory("path/to/nested/dir")

# Get directory client
directory_client = file_system_client.get_directory_client("mydir")

# Delete directory
directory_client.delete_directory()

# Rename/move directory
directory_client.rename_directory(new_name="myfilesystem/newname")

File Operations

Upload File

# Get file client
file_client = file_system_client.get_file_client("path/to/file.txt")

# Upload from local file
with open("local-file.txt", "rb") as data:
    file_client.upload_data(data, overwrite=True)

# Upload bytes
file_client.upload_data(b"Hello, Data Lake!", overwrite=True)

# Append data (for large files)
file_client.append_data(data=b"chunk1", offset=0, length=6)
file_client.append_data(data=b"chunk2", offset=6, length=6)
file_client.flush_data(12)  # Commit the data

Download File

file_client = file_system_client.get_file_client("path/to/file.txt")

# Download all content
download = file_client.download_file()
content = download.readall()

# Download to file
with open("downloaded.txt", "wb") as f:
    download = file_client.download_file()
    download.readinto(f)

# Download range
download = file_client.download_file(offset=0, length=100)

Delete File

file_client.delete_file()

List Contents

# List paths (files and directories)
for path in file_system_client.get_paths():
    print(f"{'DIR' if path.is_directory else 'FILE'}: {path.name}")

# List paths in directory
for path in file_system_client.get_paths(path="mydir"):
    print(path.name)

# Recursive listing
for path in file_system_client.get_paths(path="mydir", recursive=True):
    print(path.name)

File/Directory Properties

# Get properties
properties = file_client.get_file_properties()
print(f"Size: {properties.size}")
print(f"Last modified: {properties.last_modified}")

# Set metadata
file_client.set_metadata(metadata={"processed": "true"})

Access Control (ACL)

# Get ACL
acl = directory_client.get_access_control()
print(f"Owner: {acl['owner']}")
print(f"Permissions: {acl['permissions']}")

# Set ACL
directory_client.set_access_control(
    owner="user-id",
    permissions="rwxr-x---"
)

# Update ACL entries
from azure.storage.filedatalake import AccessControlChangeResult
directory_client.update_access_control_recursive(
    acl="user:user-id:rwx"
)

Async Client

from azure.storage.filedatalake.aio import DataLakeServiceClient
from azure.identity.aio import DefaultAzureCredential

async def datalake_operations():
    credential = DefaultAzureCredential()
    
    async with DataLakeServiceClient(
        account_url="https://<account>.dfs.core.windows.net",
        credential=credential
    ) as service_client:
        file_system_client = service_client.get_file_system_client("myfilesystem")
        file_client = file_system_client.get_file_client("test.txt")
        
        await file_client.upload_data(b"async content", overwrite=True)
        
        download = await file_client.download_file()
        content = await download.readall()

import asyncio
asyncio.run(datalake_operations())

Best Practices

  1. Use hierarchical namespace for file system semantics
  2. Use append_data + flush_data for large file uploads
  3. Set ACLs at directory level and inherit to children
  4. Use async client for high-throughput scenarios
  5. Use get_paths with recursive=True for full directory listing
  6. Set metadata for custom file attributes
  7. Consider Blob API for simple object storage use cases

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Frequently asked questions about Azure Data Lake SDK

Similar skills