Comprehensive Python client library for InfluxDB 2.x with sync/async APIs for writing, querying, and managing time series data.
82
Build a system that reads sensor data from multiple sources and writes it to a time-series database with appropriate numeric field types to avoid type conflicts.
Different sensors produce numeric values in different formats. Some sensors return signed integers (temperature in Celsius), others return unsigned integers (counts, IDs), and some return floating-point values (pressure in atmospheres). When writing this data to a time-series database, it's important to specify the correct numeric type for each field to prevent schema conflicts and ensure data integrity.
Create a Python module that:
@generates
def write_sensor_data(client, bucket: str, measurement: str, sensor_data: dict, timestamp=None):
"""
Write sensor data to the time-series database with appropriate field types.
Args:
client: Database client instance
bucket: Target bucket name
measurement: Measurement name for the data point
sensor_data: Dictionary containing sensor readings with keys:
- 'temperature': signed integer (Celsius)
- 'counter': unsigned integer
- 'pressure': float (atmospheres)
timestamp: Optional timestamp for the data point (defaults to current time)
Returns:
None
"""
passProvides time-series data writing capabilities with field type customization support.
@satisfied-by
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