[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dc2abe7a-fb0a-4349-8e22-49574fa98240":3,"$fYVmxoaqRcW-ZB7ZK1uW-mrXftYBm3BB_5mJU1Yxx0YI":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"dc2abe7a-fb0a-4349-8e22-49574fa98240","azure-storage-file-datalake-py","Azure数据湖存储Gen2 SDK for Python。用于分层文件系统、大数据分析和文件\u002F目录操作。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-storage-file-datalake-py\ndescription: Azure Data Lake Storage Gen2 SDK for Python. Use for hierarchical file systems, big data analytics, and file\u002Fdirectory operations.\nrisk: unknown\nsource: community\ndate_added: '2026-02-27'\n---\n\n# Azure Data Lake Storage Gen2 SDK for Python\n\nHierarchical file system for big data analytics workloads.\n\n## Installation\n\n```bash\npip install azure-storage-file-datalake azure-identity\n```\n\n## Environment Variables\n\n```bash\nAZURE_STORAGE_ACCOUNT_URL=https:\u002F\u002F\u003Caccount>.dfs.core.windows.net\n```\n\n## Authentication\n\n```python\nfrom azure.identity import DefaultAzureCredential\nfrom azure.storage.filedatalake import DataLakeServiceClient\n\ncredential = DefaultAzureCredential()\naccount_url = \"https:\u002F\u002F\u003Caccount>.dfs.core.windows.net\"\n\nservice_client = DataLakeServiceClient(account_url=account_url, credential=credential)\n```\n\n## Client Hierarchy\n\n| Client | Purpose |\n|--------|---------|\n| `DataLakeServiceClient` | Account-level operations |\n| `FileSystemClient` | Container (file system) operations |\n| `DataLakeDirectoryClient` | Directory operations |\n| `DataLakeFileClient` | File operations |\n\n## File System Operations\n\n```python\n# Create file system (container)\nfile_system_client = service_client.create_file_system(\"myfilesystem\")\n\n# Get existing\nfile_system_client = service_client.get_file_system_client(\"myfilesystem\")\n\n# Delete\nservice_client.delete_file_system(\"myfilesystem\")\n\n# List file systems\nfor fs in service_client.list_file_systems():\n    print(fs.name)\n```\n\n## Directory Operations\n\n```python\nfile_system_client = service_client.get_file_system_client(\"myfilesystem\")\n\n# Create directory\ndirectory_client = file_system_client.create_directory(\"mydir\")\n\n# Create nested directories\ndirectory_client = file_system_client.create_directory(\"path\u002Fto\u002Fnested\u002Fdir\")\n\n# Get directory client\ndirectory_client = file_system_client.get_directory_client(\"mydir\")\n\n# Delete directory\ndirectory_client.delete_directory()\n\n# Rename\u002Fmove directory\ndirectory_client.rename_directory(new_name=\"myfilesystem\u002Fnewname\")\n```\n\n## File Operations\n\n### Upload File\n\n```python\n# Get file client\nfile_client = file_system_client.get_file_client(\"path\u002Fto\u002Ffile.txt\")\n\n# Upload from local file\nwith open(\"local-file.txt\", \"rb\") as data:\n    file_client.upload_data(data, overwrite=True)\n\n# Upload bytes\nfile_client.upload_data(b\"Hello, Data Lake!\", overwrite=True)\n\n# Append data (for large files)\nfile_client.append_data(data=b\"chunk1\", offset=0, length=6)\nfile_client.append_data(data=b\"chunk2\", offset=6, length=6)\nfile_client.flush_data(12)  # Commit the data\n```\n\n### Download File\n\n```python\nfile_client = file_system_client.get_file_client(\"path\u002Fto\u002Ffile.txt\")\n\n# Download all content\ndownload = file_client.download_file()\ncontent = download.readall()\n\n# Download to file\nwith open(\"downloaded.txt\", \"wb\") as f:\n    download = file_client.download_file()\n    download.readinto(f)\n\n# Download range\ndownload = file_client.download_file(offset=0, length=100)\n```\n\n### Delete File\n\n```python\nfile_client.delete_file()\n```\n\n## List Contents\n\n```python\n# List paths (files and directories)\nfor path in file_system_client.get_paths():\n    print(f\"{'DIR' if path.is_directory else 'FILE'}: {path.name}\")\n\n# List paths in directory\nfor path in file_system_client.get_paths(path=\"mydir\"):\n    print(path.name)\n\n# Recursive listing\nfor path in file_system_client.get_paths(path=\"mydir\", recursive=True):\n    print(path.name)\n```\n\n## File\u002FDirectory Properties\n\n```python\n# Get properties\nproperties = file_client.get_file_properties()\nprint(f\"Size: {properties.size}\")\nprint(f\"Last modified: {properties.last_modified}\")\n\n# Set metadata\nfile_client.set_metadata(metadata={\"processed\": \"true\"})\n```\n\n## Access Control (ACL)\n\n```python\n# Get ACL\nacl = directory_client.get_access_control()\nprint(f\"Owner: {acl['owner']}\")\nprint(f\"Permissions: {acl['permissions']}\")\n\n# Set ACL\ndirectory_client.set_access_control(\n    owner=\"user-id\",\n    permissions=\"rwxr-x---\"\n)\n\n# Update ACL entries\nfrom azure.storage.filedatalake import AccessControlChangeResult\ndirectory_client.update_access_control_recursive(\n    acl=\"user:user-id:rwx\"\n)\n```\n\n## Async Client\n\n```python\nfrom azure.storage.filedatalake.aio import DataLakeServiceClient\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def datalake_operations():\n    credential = DefaultAzureCredential()\n    \n    async with DataLakeServiceClient(\n        account_url=\"https:\u002F\u002F\u003Caccount>.dfs.core.windows.net\",\n        credential=credential\n    ) as service_client:\n        file_system_client = service_client.get_file_system_client(\"myfilesystem\")\n        file_client = file_system_client.get_file_client(\"test.txt\")\n        \n        await file_client.upload_data(b\"async content\", overwrite=True)\n        \n        download = await file_client.download_file()\n        content = await download.readall()\n\nimport asyncio\nasyncio.run(datalake_operations())\n```\n\n## Best Practices\n\n1. **Use hierarchical namespace** for file system semantics\n2. **Use `append_data` + `flush_data`** for large file uploads\n3. **Set ACLs at directory level** and inherit to children\n4. **Use async client** for high-throughput scenarios\n5. **Use `get_paths` with `recursive=True`** for full directory listing\n6. **Set metadata** for custom file attributes\n7. **Consider Blob API** for simple object storage use cases\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,213,537,"2026-05-16 13:07:53",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"99623a3a-0d31-402f-ba42-1db23d548520","1.0.0","azure-storage-file-datalake-py.zip",2074,"uploads\u002Fskills\u002Fdc2abe7a-fb0a-4349-8e22-49574fa98240\u002Fazure-storage-file-datalake-py.zip","a1be1bae0bfc3f77bdb708274762a416f4f03b47a871fa47c09b3164f8abe35f","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":5802}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]