Microsoft Azure File DataLake Storage Client Library for Python
Overall
score
92%
Build a metadata management utility for Azure Data Lake Storage Gen2 that allows users to track and organize files using custom metadata tags.
Your implementation should provide the following functionality:
Create a utility that can:
@generates
class FileMetadataManager:
"""
Manages custom metadata for files in Azure Data Lake Storage Gen2.
"""
def __init__(self, account_url: str, file_system_name: str, credential):
"""
Initialize the metadata manager.
Args:
account_url: The URL to the Data Lake Storage account (e.g., https://<account>.dfs.core.windows.net)
file_system_name: The name of the file system (container) to work with
credential: Authentication credential (can be account key, SAS token, or Azure AD credential)
"""
pass
def add_metadata(self, file_path: str, metadata: dict) -> None:
"""
Add custom metadata to a file.
Args:
file_path: Path to the file within the file system
metadata: Dictionary of metadata key-value pairs to add
"""
pass
def get_metadata(self, file_path: str) -> dict:
"""
Retrieve all metadata associated with a file.
Args:
file_path: Path to the file within the file system
Returns:
Dictionary containing all metadata key-value pairs
"""
pass
def update_metadata(self, file_path: str, metadata: dict) -> None:
"""
Update metadata on a file, replacing existing metadata.
Args:
file_path: Path to the file within the file system
metadata: Dictionary of new metadata key-value pairs
"""
pass
def has_metadata_key(self, file_path: str, key: str) -> bool:
"""
Check if a file has a specific metadata key.
Args:
file_path: Path to the file within the file system
key: The metadata key to check for
Returns:
True if the key exists in the file's metadata, False otherwise
"""
passProvides Azure Data Lake Storage Gen2 client library for Python.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-azure-storage-file-datalakedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10