or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-storage-file-datalake@12.21.x
tile.json

tessl/pypi-azure-storage-file-datalake

tessl install tessl/pypi-azure-storage-file-datalake@12.21.0

Microsoft Azure File DataLake Storage Client Library for Python

Agent Success

Agent success rate when using this tile

92%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

93%

task.mdevals/scenario-1/

File Metadata Manager

Build a metadata management utility for Azure Data Lake Storage Gen2 that allows users to track and organize files using custom metadata tags.

Requirements

Your implementation should provide the following functionality:

Metadata Operations

Create a utility that can:

  1. Add custom metadata key-value pairs to files in Azure Data Lake Storage
  2. Retrieve all metadata associated with a file
  3. Update existing metadata on a file
  4. Check if a file has specific metadata keys

Implementation Details

  • Accept a file path within a file system to identify the target file
  • Support multiple metadata key-value pairs (both keys and values are strings)
  • Handle the case where metadata is added to a file that doesn't have any metadata yet
  • Handle the case where metadata is updated for a file that already has metadata
  • Provide clear output when retrieving metadata

Test Cases

  • Adding metadata {"project": "analytics", "stage": "production"} to a new file successfully stores the metadata @test
  • Retrieving metadata from a file returns all key-value pairs that were previously set @test
  • Updating metadata on a file with new values {"stage": "development", "version": "2.0"} replaces existing metadata @test
  • Checking if a file has metadata key "project" returns true when that key exists @test

Implementation

@generates

API

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
        """
        pass

Dependencies { .dependencies }

azure-storage-file-datalake { .dependency }

Provides Azure Data Lake Storage Gen2 client library for Python.

@satisfied-by