Python and InfluxDBUse This InfluxDB Integration for Free
Build IoT, analytics, and cloud applications using the Python client library with InfluxDB.
Why use the InfluxDB Python Client Library?
InfluxDB is an API-first time series database for your Python applications. Use the InfluxDB open-source Python API client to write and query data into your applications and even manage your InfluxDB instance from within your app.
- Provides API access to all InfluxDB Write and Read functionality, settings, and advanced features
- Write data in InfluxDB line protocol, point data structure, or as a pandas dataframe
- Easily configure timeouts, delays, and request retries
- Batch data to InfluxDB to gain greater efficiency
- Return InfluxDB data as a Flux Table Structure, string, csv, stream, or dataframe
- Panda dataframe integration
Batching Data with the InfluxDB's Python Client Library
Querying Data with InfluxDB's Python Client Library
Using the InfluxDB Python Client Library Administrative APIs
from influxdb_client import InfluxDBClient url = 'https://us-west-2-1.aws.cloud2.influxdata.com' token = 'my-token' org = 'my-org' bucket = 'my-bucket' with InfluxDBClient(url=url, token=token, org=org) as client: query_api = client.query_api() tables = query_api.query('from(bucket: "my-bucket") |> range(start: -1d)') for table in tables: for record in table.records: print(str(record["_time"]) + " - " + record.get_measurement() + " " + record.get_field() + "=" + str(record.get_value()))