influxdb-client-python

The official Python client for InfluxDB 2.x/Cloud with sync, async, and pandas-native APIs

SDK
PyPI
v1.50.0
792stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
74/100Good
Development Activity64
Maintenance64
Community80
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
69/100Good
Architecture74
Code Quality75
Innovation66
Learning Curve62

influxdb-client-python is InfluxData’s official Python client for InfluxDB 2.x and InfluxDB Cloud, providing dedicated APIs for writing points (WriteApi), running Flux/InfluxQL queries (QueryApi), and managing buckets, organizations, tasks, and authorizations. It ships both synchronous and asyncio-based (influxdb_client_async) clients, so it fits equally into traditional scripts and async services.

Built for the time-series-and-analytics workflow InfluxDB targets, the client integrates directly with pandas (query_data_frame()), Jupyter notebooks, and supports batched, backpressure-aware writes for high-throughput ingestion from sensors, metrics pipelines, or IoT devices.

What You Get

  • WriteApi/WriteApiAsync for batched, backpressure-aware point writes
  • QueryApi/QueryApiAsync for running Flux and InfluxQL queries, including query_data_frame() for direct pandas integration
  • Management APIs for buckets, organizations, users, tasks, labels, and authorizations
  • Both synchronous and asyncio-native client classes (InfluxDBClient and InfluxDBClientAsync)
  • Configurable retry, logging, and connection-pooling behavior via configuration.py

Common Use Cases

  • Ingesting high-throughput sensor or IoT metrics into InfluxDB from Python services
  • Querying time-series data with Flux and loading results directly into pandas for analysis
  • Automating InfluxDB administration (buckets, orgs, tasks) from CI/CD or provisioning scripts
  • Building async Python services that write and query InfluxDB without blocking the event loop

Under The Hood

Architecture - The client separates concerns cleanly under influxdb_client/client/: write_api.py implements batched writes with a background flush thread and configurable batching/retry policy, query_api.py parses Flux CSV responses (flux_csv_parser.py) into FluxTable/pandas structures, and management endpoints (buckets_api.py, organizations_api.py, tasks_api.py, etc.) are thin wrappers over a generated domain/service layer that mirrors the InfluxDB v2 OpenAPI spec; a parallel _async/_sync split lets the same generated service layer back both synchronous and asyncio client entry points.

Tech Stack - Python 3.8+ package built with setup.py, depending on urllib3, certifi, python-dateutil, with optional pandas/ciso8601 extras for DataFrame query results and faster timestamp parsing; the domain/service directories show clear signs of being generated from an OpenAPI/Swagger spec rather than hand-written, consistent with InfluxData’s other official OSS clients.

Code Quality - 34 test modules cover write batching, Flux CSV parsing, and API wrappers, with CircleCI and Codecov badges indicating an established CI pipeline; the ~4,650-line client/ package is organized one file per API resource (buckets, orgs, tasks, users), which keeps individual modules small even though the generated domain/service layers add significant additional surface area.

API Design - The top-level InfluxDBClient acts as a factory for resource-specific API objects (client.write_api(), client.query_api(), client.buckets_api()), which is a consistent and discoverable pattern once learned, though newcomers unfamiliar with InfluxDB’s own concepts (buckets, orgs, Flux query language) face a real learning curve independent of the client’s own ergonomics; the parallel async client mirrors the same method names, minimizing friction when migrating between sync and async code.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search