Ctrl + K
DocumentationLog inGet started

tessl/pypi-influxdb-client

tessl install tessl/pypi-influxdb-client@1.49.0

Comprehensive Python client library for InfluxDB 2.x with sync/async APIs for writing, querying, and managing time series data.

Agent Success

Agent success rate when using this tile

82%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

69%

task.mdevals/scenario-1/

Time Series Data Analysis Tool

Build a command-line tool that queries InfluxDB time series data and outputs results in multiple formats based on user requirements.

Problem Description

You need to implement a tool that retrieves temperature sensor data from InfluxDB and provides flexible output formatting. The tool should support three different output modes to accommodate different use cases:

  1. Structured format: Output data as a structured list of records with field names and values
  2. CSV format: Output raw CSV data for import into spreadsheet applications
  3. Statistical summary: Perform basic statistical analysis and output summary statistics

Requirements

Your implementation should:

  1. Connect to InfluxDB and execute a Flux query to retrieve temperature sensor data
  2. Accept a command-line argument to specify the output format: structured, csv, or summary
  3. For structured format: Print each record showing measurement name, timestamp, field names and values
  4. For csv format: Print the raw CSV output from the query
  5. For summary format: Convert results to a format suitable for statistical analysis and compute mean and max temperature

Input Specification

  • InfluxDB connection details should be configurable (URL, token, organization, bucket)
  • The Flux query should filter for measurement "temperature" from the last 24 hours
  • The output format should be specified via command-line argument

Test Cases

  • Given output format "structured", the tool prints records with measurement names, timestamps, and field values @test
  • Given output format "csv", the tool prints CSV formatted data @test
  • Given output format "summary", the tool prints mean and maximum temperature values @test

Implementation

@generates

API

def query_temperature_data(client, bucket: str, format_type: str):
    """
    Query temperature sensor data from InfluxDB and output in specified format.

    Args:
        client: InfluxDB client instance
        bucket: Name of the bucket to query
        format_type: Output format - 'structured', 'csv', or 'summary'

    Returns:
        None (prints output to console)
    """
    pass

Dependencies { .dependencies }

influxdb-client { .dependency }

Python client library for InfluxDB 2.x providing query capabilities with multiple output formats.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/influxdb-client@1.49.x
tile.json