# influxdata/influxdb-client-python architecture

> Architecture diagram of the GitHub repository influxdata/influxdb-client-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/influxdata/influxdb-client-python
- Repository: https://github.com/influxdata/influxdb-client-python

## Overview

#### Purpose and Public Entry Points
This is the Python client library for InfluxDB 2.x and Flux, with InfluxDB 1.8 forward-compatible endpoints. Applications import synchronous `InfluxDBClient` and data-building types from `influxdb_client/__init__.py`; the principal client façade is `influxdb_client/client/influxdb_client.py`. Async applications use `influxdb_client/client/influxdb_client_async.py`.

#### Client Construction and Transport Boundary
Client instances hold endpoint, organization, authentication, TLS/mTLS, proxy, gzip, timeout, pooling, and retry configuration. Configuration can be built from arguments, files, or environment through `influxdb_client/configuration.py`. Synchronous HTTP uses generated-client plumbing in `influxdb_client/_sync/api_client.py` and `influxdb_client/_sync/rest.py`; asynchronous transport uses `aiohttp`-oriented counterparts in `influxdb_client/_async/api_client.py` and `influxdb_client/_async/rest.py`. The external boundary is an InfluxDB HTTP API (local, Cloud, or 1.8-compatible server).

#### API Facades and Generated Management Layer
`InfluxDBClient` exposes focused facades for writes, Flux queries, deletes, health/ping, and resource management. High-level wrappers include `influxdb_client/client/query_api.py`, `influxdb_client/client/delete_api.py`, and management APIs such as `influxdb_client/client/bucket_api.py`. These call generated endpoint services under `influxdb_client/service/`, for example `influxdb_client/service/buckets_service.py` and `influxdb_client/service/write_service.py`. Request/response schemas are generated domain models in `influxdb_client/domain/`, e.g. `influxdb_client/domain/bucket.py` and `influxdb_client/domain/query.py`.

#### Write Pipeline
Writes accept line protocol, `Point`, mappings, dataclasses, named tuples, Pandas DataFrames, lists, and—in batching mode—RxPY observables. `influxdb_client/client/write_api.py` normalizes records, applies default tags, serializes them to line protocol, batches by destination/precision, and sends write requests. `influxdb_client/client/write/point.py` is the fluent point model and line-protocol serializer; `influxdb_client/client/write/dataframe_serializer.py` is the Pandas conversion boundary. Default mode is background batching via RxPY; synchronous mode performs the HTTP request inline. Retry/backoff policy for failed batches is defined in `influxdb_client/client/write/retry.py`; background failures are reported through callbacks rather than caller exceptions.

#### Query Pipeline
`influxdb_client/client/query_api.py` submits Flux queries, optionally parameterized and profiler-enabled, to the query service. It exposes raw text/CSV, iterable records, `FluxTable` collections, streaming records, and Pandas DataFrames. `influxdb_client/client/flux_csv_parser.py` parses annotated Flux CSV and materializes table/record structures from `influxdb_client/client/flux_table.py`; profiler measurements are treated separately from normal results. Streaming permits early consumer termination and explicit closure.

#### Async Execution Model
The async façade mirrors core query, write, delete, health, and generated management capabilities: `influxdb_client/client/influxdb_client_async.py`, `influxdb_client/client/query_api_async.py`, and `influxdb_client/client/write_api_async.py`. It requires execution inside an asyncio coroutine/event loop and uses aiohttp/aiocsv dependencies. Async writes are awaitable request operations; query APIs support async generators for records and DataFrames.

#### Operational Boundaries
Authentication supports token, username/password session, and reverse-proxy HTTP Basic patterns. The client supports TLS verification/custom CAs/mTLS, proxy headers, configurable redirects, and optional gzip. Public errors are centralized in `influxdb_client/client/exceptions.py`; non-batched request failures propagate to the application. Documentation and package APIs are maintained alongside generated source conventions, with source regeneration supported by `scripts/generate-sources.sh`.

Main entry points: [`influxdb_client/service/write_service.py`](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/service/write_service.py) (Endpoint services), [`influxdb_client/client/influxdb_client.py`](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client.py) (InfluxDBClient), [`influxdb_client/client/write_api.py`](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api.py) (Write API), [`influxdb_client/client/influxdb_client_async.py`](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client_async.py) (InfluxDBClientAsync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sync["Synchronous client"]
  node_sync_client["InfluxDBClient<br/>sync façade<br/>[influxdb_client.py]"]
  node_write_api["Write API<br/>write pipeline<br/>[write_api.py]"]
  node_point["Point serializer<br/>line protocol<br/>[point.py]"]
  node_dataframe_serializer["DataFrame converter<br/>Pandas boundary"]
  node_retry["Batch retry policy<br/>backoff<br/>[retry.py]"]
  node_query_api["Query API<br/>Flux façade<br/>[query_api.py]"]
  node_flux_parser["Flux CSV parser<br/>result parser<br/>[flux_csv_parser.py]"]
  node_flux_table["Flux tables and records<br/>query results<br/>[flux_table.py]"]
  node_delete_api["Delete API<br/>delete façade<br/>[delete_api.py]"]
  node_management_api["Management APIs<br/>resource façades<br/>[bucket_api.py]"]
  node_sync_transport["Sync HTTP transport<br/>generated transport<br/>[api_client.py]"]
end

subgraph group_async["Async client"]
  node_async_client["InfluxDBClientAsync<br/>async façade"]
  node_async_query["Async Query API<br/>async Flux façade<br/>[query_api_async.py]"]
  node_async_write["Async Write API<br/>async write façade<br/>[write_api_async.py]"]
  node_async_transport["Async HTTP transport<br/>aiohttp transport<br/>[api_client.py]"]
end

subgraph group_generated["Generated API layer"]
  node_services["Endpoint services<br/>generated services<br/>[write_service.py]"]
  node_domain_models["Domain models<br/>generated schemas<br/>[bucket.py]"]
end

node_public_api["Public package API<br/>imports<br/>[__init__.py]"]
node_configuration["Client configuration<br/>[configuration.py]"]
node_exceptions["Public exceptions<br/>error contract<br/>[exceptions.py]"]
node_influxdb{{"InfluxDB HTTP API<br/>external service"}}

node_public_api -->|"exports"| node_sync_client
node_public_api -->|"exports"| node_async_client
node_configuration -->|"configures"| node_sync_client
node_configuration -->|"configures"| node_async_client
node_sync_client -->|"creates"| node_write_api
node_sync_client -->|"creates"| node_query_api
node_sync_client -->|"creates"| node_delete_api
node_sync_client -->|"creates"| node_management_api
node_write_api -->|"serializes"| node_point
node_write_api -->|"converts DataFrames"| node_dataframe_serializer
node_write_api -->|"retries batches"| node_retry
node_write_api -->|"writes through"| node_services
node_query_api -->|"submits Flux"| node_services
node_query_api -->|"parses CSV"| node_flux_parser
node_flux_parser -->|"materializes"| node_flux_table
node_delete_api -->|"calls"| node_services
node_management_api -->|"calls"| node_services
node_services -->|"uses schemas"| node_domain_models
node_services -->|"uses"| node_sync_transport
node_sync_transport -->|"HTTP"| node_influxdb
node_async_client -->|"creates"| node_async_query
node_async_client -->|"creates"| node_async_write
node_async_query -->|"submits Flux"| node_services
node_async_write -->|"writes through"| node_services
node_services -->|"uses asynchronously"| node_async_transport
node_async_transport -->|"HTTP"| node_influxdb
node_sync_client -.->|"raises"| node_exceptions
node_async_client -.->|"raises"| node_exceptions

click node_public_api "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/__init__.py"
click node_configuration "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/configuration.py"
click node_sync_client "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client.py"
click node_write_api "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api.py"
click node_point "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/point.py"
click node_dataframe_serializer "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/dataframe_serializer.py"
click node_retry "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/retry.py"
click node_query_api "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/query_api.py"
click node_flux_parser "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/flux_csv_parser.py"
click node_flux_table "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/flux_table.py"
click node_delete_api "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/delete_api.py"
click node_management_api "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/bucket_api.py"
click node_sync_transport "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/_sync/api_client.py"
click node_async_client "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client_async.py"
click node_async_query "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/query_api_async.py"
click node_async_write "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api_async.py"
click node_async_transport "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/_async/api_client.py"
click node_services "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/service/write_service.py"
click node_domain_models "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/domain/bucket.py"
click node_exceptions "https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/exceptions.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sync_client,node_write_api,node_point,node_dataframe_serializer,node_retry,node_query_api,node_flux_parser,node_flux_table,node_delete_api,node_management_api,node_sync_transport toneBlue
class node_async_client,node_async_query,node_async_write,node_async_transport toneAmber
class node_services,node_domain_models toneMint
class node_public_api,node_configuration,node_exceptions,node_influxdb toneNeutral
```

## Components

### Synchronous client

- [InfluxDBClient](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client.py): sync façade · `influxdb_client/client/influxdb_client.py`
- [Write API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api.py): write pipeline · Normalizes records, applies tags, batches, and dispatches writes. · `influxdb_client/client/write_api.py`
- [Point serializer](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/point.py): line protocol · `influxdb_client/client/write/point.py`
- [DataFrame converter](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/dataframe_serializer.py): Pandas boundary · `influxdb_client/client/write/dataframe_serializer.py`
- [Batch retry policy](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write/retry.py): backoff · Reports background batch failures through callbacks. · `influxdb_client/client/write/retry.py`
- [Query API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/query_api.py): Flux façade · `influxdb_client/client/query_api.py`
- [Flux CSV parser](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/flux_csv_parser.py): result parser · Materializes tables and records and separates profiler output. · `influxdb_client/client/flux_csv_parser.py`
- [Flux tables and records](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/flux_table.py): query results · `influxdb_client/client/flux_table.py`
- [Delete API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/delete_api.py): delete façade · `influxdb_client/client/delete_api.py`
- [Management APIs](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/bucket_api.py): resource façades · Buckets and other server resources. · `influxdb_client/client/bucket_api.py`
- [Sync HTTP transport](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/_sync/api_client.py): generated transport · `influxdb_client/_sync/api_client.py`

### Async client

- [InfluxDBClientAsync](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/influxdb_client_async.py): async façade · Requires an asyncio event loop. · `influxdb_client/client/influxdb_client_async.py`
- [Async Query API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/query_api_async.py): async Flux façade · Provides awaitable and async-generator query results. · `influxdb_client/client/query_api_async.py`
- [Async Write API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/write_api_async.py): async write façade · Dispatches awaitable write requests. · `influxdb_client/client/write_api_async.py`
- [Async HTTP transport](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/_async/api_client.py): aiohttp transport · `influxdb_client/_async/api_client.py`

### Generated API layer

- [Endpoint services](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/service/write_service.py): generated services · Generated request endpoints for writes, queries, and resources. · `influxdb_client/service/write_service.py`
- [Domain models](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/domain/bucket.py): generated schemas · Generated request and response types. · `influxdb_client/domain/bucket.py`

### Other components

- [Public package API](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/__init__.py): imports · `influxdb_client/__init__.py`
- [Client configuration](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/configuration.py): configuration · Builds connection and operational settings from arguments, files, or environment. · `influxdb_client/configuration.py`
- [Public exceptions](https://github.com/influxdata/influxdb-client-python/blob/master/influxdb_client/client/exceptions.py): error contract · `influxdb_client/client/exceptions.py`
- **InfluxDB HTTP API**: external service · InfluxDB 2.x, Cloud, or 1.8-compatible endpoint.

## Connections

- Public package API → InfluxDBClient: exports
- Public package API → InfluxDBClientAsync: exports
- Client configuration → InfluxDBClient: configures
- Client configuration → InfluxDBClientAsync: configures
- InfluxDBClient → Write API: creates
- InfluxDBClient → Query API: creates
- InfluxDBClient → Delete API: creates
- InfluxDBClient → Management APIs: creates
- Write API → Point serializer: serializes
- Write API → DataFrame converter: converts DataFrames
- Write API → Batch retry policy: retries batches
- Write API → Endpoint services: writes through
- Query API → Endpoint services: submits Flux
- Query API → Flux CSV parser: parses CSV
- Flux CSV parser → Flux tables and records: materializes
- Delete API → Endpoint services: calls
- Management APIs → Endpoint services: calls
- Endpoint services → Domain models: uses schemas
- Endpoint services → Sync HTTP transport: uses
- Sync HTTP transport → InfluxDB HTTP API: HTTP
- InfluxDBClientAsync → Async Query API: creates
- InfluxDBClientAsync → Async Write API: creates
- Async Query API → Endpoint services: submits Flux
- Async Write API → Endpoint services: writes through
- Endpoint services → Async HTTP transport: uses asynchronously
- Async HTTP transport → InfluxDB HTTP API: HTTP
- InfluxDBClient → Public exceptions: raises
- InfluxDBClientAsync → Public exceptions: raises
