# https://www.influxdata.com/blog/getting-started-with-python-and-influxdb-v2-0/ from influxdb_client import InfluxDBClient, Point from influxdb_client .client.write_api import SYNCHRONOUS token='randomTokenValue' org='chooseOrgName' bucket='chooseBucketName' with InfluxDBClient(url='http://localhost:8086', host='localhost', token=token, org=org, debug=False) as client: """ Create client that writes data in batches with 50_000 items. """ with client.write_api( write_options=WriteOptions(SYNCHRONOUS, batch_size=50_000, flush_interval=10_000)) as write_api: for item in op.get_device(device_id, startUnixtime, endUnixtime): if not item[4]: # no error point = Point('vehicle').tag('device', device_id).field(item[1], item[3]).time(time=item[0]) write_api.write(bucket=bucket, record=point)