Comprehensive Python client library for InfluxDB 2.x with sync/async APIs for writing, querying, and managing time series data.
82
Build a command-line tool that queries InfluxDB time series data and outputs results in multiple formats based on user requirements.
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:
Your implementation should:
structured, csv, or summarystructured format: Print each record showing measurement name, timestamp, field names and valuescsv format: Print the raw CSV output from the querysummary format: Convert results to a format suitable for statistical analysis and compute mean and max temperature@generates
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)
"""
passPython client library for InfluxDB 2.x providing query capabilities with multiple output formats.
Install with Tessl CLI
npx tessl i tessl/pypi-influxdb-clientdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10