Azure Data Lake Storage Gen2 SDK for Python
在 Python 中使用 Azure Data Lake Storage
此技能使 Claude 能夠使用 Python SDK 與 Azure Data Lake Storage Gen2 互動,提供檔案操作、目錄管理及雲端資料工作流程的存取控制功能。
تنزيل ZIP المهارة
رفع في Claude
اذهب إلى Settings → Capabilities → Skills → Upload skill
فعّل وابدأ الاستخدام
اختبرها
استخدام "Azure Data Lake Storage Gen2 SDK for Python". How do I create a new file system in Azure Data Lake Gen2?
النتيجة المتوقعة:
- 若要在 Azure Data Lake Gen2 中建立檔案系統(容器):
- 1. 使用 DataLakeServiceClient 連線至您的儲存體帳戶
- 2. 呼叫 create_file_system() 方法
- 範例程式碼:
- ```python
- from azure.storage.filedatalake import DataLakeServiceClient
- def create_datalake_filesystem(storage_account_name, sas_token):
- service_client = DataLakeServiceClient(
- account_url=f"https://{storage_account_name}.dfs.core.windows.net",
- credential=sas_token
- )
- filesystem_client = service_client.create_file_system('my-container')
- return filesystem_client
- ```
استخدام "Azure Data Lake Storage Gen2 SDK for Python". What are best practices for organizing data in Data Lake?
النتيجة المتوقعة:
- Azure Data Lake 組織的最佳實踐:
- 1. **使用階層式命名空間** - 建立時啟用以獲得 HDFS 相容路徑
- 2. **遵循命名慣例** - 使用小寫、連字號、一致的日期格式
- 3. **實作分层儲存** - 使用生命週期原則進行熱/暖/冷層級管理
- 4. **設定適當的 ACL** - 授予最低需求的權限
- 5. **明智地分割** - 按常見查詢欄位如日期/區域進行組織
استخدام "Azure Data Lake Storage Gen2 SDK for Python". How do I configure access permissions for a directory?
النتيجة المتوقعة:
- 若要在 Azure Data Lake Gen2 上設定 ACL:
- 1. 使用 get_directory_client() 取得目錄用戶端
- 2. 使用 set_access_control() 設定 POSIX 風格的權限
- 3. 或使用 update_access_control_recursive() 進行批次更新
- 權限遵循 POSIX 格式:owner:group:permissions
- 範例:'user::rwx,group::r-x,other::r--'
التدقيق الأمني
آمنStatic analysis scanned 0 files (0 lines) and detected 0 potential security issues. This is a prompt-only skill with no executable code. The skill provides descriptions and context for Azure Data Lake Storage Gen2 SDK usage without executing any operations. Risk score: 0/100.
درجة الجودة
ماذا يمكنك بناءه
管理資料管道的雲端資料工程師
產生 Python 程式碼以在本地系統和 Azure Data Lake 之間移動資料,用於 ETL 管道
建構無伺服器應用程式的開發人員
為無伺服器應用程式建立及設定 Azure Data Lake 儲存體,並設定適當的存取控制
組織資料集的資料科學家
在 Azure Data Lake 中使用適當的階層結構來組織機器學習資料集
جرّب هذه الموجهات
展示如何使用 Python SDK 列出 Azure Data Lake Gen2 目錄中的所有檔案
產生 Python 程式碼將檔案上傳至 Azure Data Lake Storage,並設定特定的 ACL 權限
協助我在 Azure Data Lake Gen2 中建立巢狀目錄結構,以便按日期和類別組織資料
建立 Python 指令碼以將大型資料夾從本地儲存體移轉至 Azure Data Lake Gen2,並包含適當的錯誤處理和日誌記錄
أفضل الممارسات
- 建立新的 Data Lake 帳戶時永遠啟用階層式命名空間,以確保 HDFS 相容性
- 使用受控識別或金鑰保存庫進行認證管理,而非將密碼硬編碼
- 為生產資料操作實作適當的錯誤處理和重試邏輯
تجنب
- 不要將 Azure 儲存體帳戶金鑰硬編碼至原始程式碼中 - 請使用環境變數或 Azure Key Vault
- 避免授予過於廣泛的權限 - 請遵循 ACL 的最低權限原則
- 不要在上傳敏感資料時未啟用靜態加密及使用適當的存取控制