or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-data-tables@12.7.x
tile.json

tessl/pypi-azure-data-tables

tessl install tessl/pypi-azure-data-tables@12.7.0

Microsoft Azure Data Tables Client Library for Python

Agent Success

Agent success rate when using this tile

90%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.97x

Baseline

Agent success rate without this tile

93%

task.mdevals/scenario-4/

Product Inventory Manager

Build a product inventory management system that stores product data with diverse data types including strings, numbers, booleans, timestamps, and binary data.

Requirements

Create a Python module that manages product inventory records with the following functionality:

Data Model

Each product record must include:

  • A unique product identifier (string)
  • Product category (string) - used for grouping
  • Product name (string)
  • Price (floating-point number)
  • Quantity in stock (integer)
  • Is active flag (boolean)
  • Last restocked timestamp (datetime)
  • Product image data (binary)
  • Product UUID (GUID)

Core Operations

  1. Add Product: Insert a new product record with all required fields
  2. Retrieve Product: Fetch a product by its category and identifier
  3. Update Product: Modify an existing product's fields
  4. Query Products: Find all products in a specific category
  5. Special Values: Handle special floating-point values (NaN, Infinity) for price fields when products are discontinued or have special pricing

Implementation Notes

  • You must properly handle all the different data types mentioned above
  • The system should automatically infer appropriate types for standard Python values
  • For special cases where automatic inference isn't sufficient, use explicit type specification
  • Ensure type information is preserved when reading data back from storage

Test Cases

  • Adding a product with name "Laptop", category "electronics", price 999.99, quantity 50, active=True, with a restock timestamp, sample binary data, and a generated UUID works correctly @test
  • Retrieving the product by category and identifier returns the same data with all types preserved @test
  • Updating a product's quantity from 50 to 45 persists the change @test
  • Querying all products in the "electronics" category returns matching products @test

Dependencies { .dependencies }

azure-data-tables { .dependency }

Provides cloud-based NoSQL data storage with support for diverse data types.

Implementation

@generates

API

def add_product(category: str, product_id: str, name: str, price: float,
                quantity: int, is_active: bool, last_restocked,
                image_data: bytes, product_uuid) -> None:
    """
    Add a new product to the inventory.

    Args:
        category: Product category (used as partition key)
        product_id: Unique product identifier (used as row key)
        name: Product name
        price: Product price (floating-point)
        quantity: Quantity in stock (integer)
        is_active: Whether product is active (boolean)
        last_restocked: Last restock datetime
        image_data: Product image as binary data
        product_uuid: Product UUID (GUID)
    """
    pass

def get_product(category: str, product_id: str) -> dict:
    """
    Retrieve a product by category and product ID.

    Args:
        category: Product category
        product_id: Product identifier

    Returns:
        Dictionary containing product data with all fields
    """
    pass

def update_product(category: str, product_id: str, **updates) -> None:
    """
    Update a product's fields.

    Args:
        category: Product category
        product_id: Product identifier
        **updates: Fields to update as keyword arguments
    """
    pass

def query_products_by_category(category: str) -> list:
    """
    Query all products in a specific category.

    Args:
        category: Product category to filter by

    Returns:
        List of product dictionaries
    """
    pass