azure-storage-file-datalake-py – skill DevOps & Hạ tầng cho agent AI
SDK Azure Data Lake Storage Gen2 cho Python. Dùng cho hệ thống tệp phân cấp, phân tích dữ liệu lớn và thao tác tệp/thư mục.
Cài skill azure-storage-file-datalake-py bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-storage-file-datalake-py-7fa3b.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /azure-storage-file-datalake-py – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-storage-file-datalake-py-7fa3b.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $azure-storage-file-datalake-py – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-storage-file-datalake-py-7fa3b.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /azure-storage-file-datalake-py – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-storage-file-datalake-py-7fa3b.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /azure-storage-file-datalake-py – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Azure Data Lake Storage Gen2 SDK for Python
Hierarchical file system for big data analytics workloads.
Installation
pip install azure-storage-file-datalake azure-identityEnvironment Variables
AZURE_STORAGE_ACCOUNT_URL=https://<account>.dfs.core.windows.netAuthentication
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
| Client | Purpose |
|--------|---------|
| DataLakeServiceClient | Account-level operations |
| FileSystemClient | Container (file system) operations |
| DataLakeDirectoryClient | Directory operations |
| DataLakeFileClient | File operations |
These are independent fragments, not a run-all script. Confirm account/filesystem/path and protect existing data before writes, renames, recursive ACL changes or deletes. Never use production placeholders as cleanup targets. Bound recursive listings/download bytes and use non-overwriting local outputs. Recursive ACL updates can partially fail: inspect counters/failure details and resume only with exact scope. Close async credentials as well as clients in failure paths; upload success does not establish business correctness.
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=False)
# Upload bytes
file_client.upload_data(b"Hello, Data Lake!", overwrite=False)
# Separate append example: create an explicitly new empty file first.
file_client = file_system_client.create_file("disposable-append-example.txt")
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 dataDownload 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=False)
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. Review ACL scope: default ACLs affect new descendants; existing descendants require a separately authorized recursive operation
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.
Skill liên quan
- azure-storage-file-share-py – SDK Azure Storage File Share cho Python. Dùng cho thư mục chia sẻ SMB, thư mục con và…
- azure-storage-file-share-ts – SDK Azure File Share cho JavaScript/TypeScript (@azure/storage-file-share) để thao tác…
- azure-storage-queue-py – SDK Azure Queue Storage cho Python. Dùng cho hàng đợi tin nhắn đáng tin cậy, phân phối…
- azure-storage-queue-ts – SDK Azure Queue Storage cho JavaScript/TypeScript (@azure/storage-queue) cho thao tác…
- azure-vms – Quản lý máy ảo Azure và scale set. Cấu hình availability set và managed disk. Dùng khi…
- azure-web-pubsub-ts – Nhắn tin thời gian thực với kết nối WebSocket và mẫu pub/sub.
- backup-recovery – Triển khai chiến lược sao lưu và khôi phục. Cấu hình rsync, Restic và sao lưu lên cloud…
- bash-linux – Các mẫu terminal Bash/Linux. Lệnh quan trọng, piping, xử lý lỗi, viết script. Dùng khi…