tessl install tessl/pypi-influxdb-client@1.49.0Comprehensive 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%
Build a data collection system for IoT sensors that efficiently writes time-series data to InfluxDB with automatic batching.
You need to build a Python application that collects measurements from multiple IoT temperature sensors and writes them to InfluxDB. The sensors produce measurements at irregular intervals, and the system must efficiently batch these writes to optimize network usage and database performance.
The system should automatically batch sensor data and flush to InfluxDB based on:
Your application should collect sensor readings with the following structure:
Implement a data writer that:
Write sensor data to InfluxDB where:
@generates
def create_sensor_writer(url: str, token: str, org: str, bucket: str):
"""
Creates and returns a configured writer for sensor data with batching enabled.
Args:
url: InfluxDB server URL
token: Authentication token
org: Organization name
bucket: Bucket name for storing data
Returns:
A tuple of (client, write_api) that should be used with context managers
"""
pass
def write_sensor_reading(write_api, sensor_id: str, location: str, temperature: float, timestamp):
"""
Writes a single sensor reading to the batch.
Args:
write_api: The write API instance from create_sensor_writer
sensor_id: Unique identifier for the sensor
location: Physical location of the sensor
temperature: Temperature reading in Celsius
timestamp: Python datetime object for the reading
"""
passProvides Python client for InfluxDB 2.x with batching capabilities.
@satisfied-by