CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-data-tables

Microsoft Azure Data Tables Client Library for Python

90

0.96x
Overview
Eval results
Files

task.mdevals/scenario-7/

Entity Version Tracker

Build a utility that retrieves entities from a table and compares their versions to detect changes.

Capabilities

Retrieve entities with metadata

  • Retrieves an entity and returns a dictionary with all properties including etag and timestamp as top-level keys @test
  • Retrieves multiple entities and returns a list where each entity has etag and timestamp as top-level keys @test

Detect entity changes

  • Compares two versions of the same entity and detects if the etag has changed @test
  • Given an entity with timestamp metadata, correctly extracts and returns the last modified time @test

Implementation

@generates

API

def get_entity_with_metadata(table_client, partition_key: str, row_key: str) -> dict:
    """
    Retrieves an entity from the table with metadata flattened into the entity dictionary.

    Args:
        table_client: The Azure Data Tables TableClient instance
        partition_key: The partition key of the entity
        row_key: The row key of the entity

    Returns:
        A dictionary containing all entity properties plus metadata (etag, timestamp) as top-level keys
    """
    pass

def get_entities_with_metadata(table_client, query_filter: str = None) -> list:
    """
    Retrieves multiple entities from the table with metadata flattened into each entity dictionary.

    Args:
        table_client: The Azure Data Tables TableClient instance
        query_filter: Optional OData filter expression to filter entities

    Returns:
        A list of dictionaries, each containing entity properties plus metadata as top-level keys
    """
    pass

def has_entity_changed(old_entity: dict, new_entity: dict) -> bool:
    """
    Determines if an entity has been modified by comparing etag values.

    Args:
        old_entity: Dictionary containing the previous version of the entity with etag
        new_entity: Dictionary containing the current version of the entity with etag

    Returns:
        True if the etags differ (entity was modified), False otherwise
    """
    pass

def get_last_modified_time(entity: dict):
    """
    Extracts the last modified timestamp from an entity dictionary.

    Args:
        entity: Dictionary containing entity data with timestamp metadata

    Returns:
        The timestamp value (datetime object) representing when the entity was last modified
    """
    pass

Dependencies { .dependencies }

azure-data-tables { .dependency }

Provides Azure Table Storage client functionality for entity operations and metadata access.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-azure-data-tables

tile.json