{"id":6380,"library":"influxdb3-python","title":"InfluxDB 3 Python Client","description":"The influxdb3-python library is the community Python client for InfluxDB 3.0 (also known as InfluxDB IOx or InfluxDB Cloud Serverless). It provides a Pythonic interface for writing and querying time-series data using Apache Arrow Flight (gRPC) and InfluxQL/SQL. The current version is 0.18.0, with new releases typically happening monthly or bi-monthly, incorporating new features and bug fixes for integration with InfluxDB 3.0.","status":"active","version":"0.18.0","language":"en","source_language":"en","source_url":"https://github.com/InfluxCommunity/influxdb3-python","tags":["database","timeseries","influxdb","data-client","io-t"],"install":[{"cmd":"pip install influxdb3-python","lang":"bash","label":"Install core client"}],"dependencies":[{"reason":"For `write_dataframe` and `query_dataframe` methods when using pandas.","package":"pandas","optional":true},{"reason":"For `write_dataframe` and `query_dataframe` methods when using polars.","package":"polars","optional":true}],"imports":[{"note":"This client is specifically for InfluxDB 3.0 and uses 'influxdb_client_3' for its package name, distinct from the InfluxDB 2.x client ('influxdb_client').","wrong":"from influxdb_client import InfluxDBClient","symbol":"InfluxDBClient3","correct":"from influxdb_client_3 import InfluxDBClient3"},{"note":"For InfluxDB 3.0, the `Point` class for data construction is directly available from the top-level `influxdb_client_3` package.","wrong":"from influxdb_client.domain.write_options import Point","symbol":"Point","correct":"from influxdb_client_3 import Point"}],"quickstart":{"code":"import os\nfrom influxdb_client_3 import InfluxDBClient3, Point\n\n# Ensure these environment variables are set or replace with actual values\n# Example: export INFLUXDB_V3_HOST=\"us-east-1-1.aws.cloud2.influxdata.com\"\nHOST = os.environ.get(\"INFLUXDB_V3_HOST\", \"us-east-1-1.aws.cloud2.influxdata.com\")\nTOKEN = os.environ.get(\"INFLUXDB_V3_TOKEN\", \"YOUR_API_TOKEN\")\nDATABASE = os.environ.get(\"INFLUXDB_V3_DATABASE\", \"YOUR_DATABASE\")\n\nclient = InfluxDBClient3(host=HOST, token=TOKEN, database=DATABASE)\n\ntry:\n    # Write data\n    point = Point(\"measurement1\").tag(\"tag1\", \"value1\").field(\"field1\", 1.0)\n    client.write(point)\n    print(\"Data written successfully.\")\n\n    # Query data\n    query = f\"SELECT * FROM measurement1 WHERE time > now() - interval '1 hour'\"\n    table = client.query(query=query, database=DATABASE)\n\n    print(\"\\nQuery results:\")\n    for row in table:\n        print(row)\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    client.close()\n","lang":"python","description":"Initializes the client, writes a single data point, and then queries data from InfluxDB 3.0. Credentials are sourced from environment variables for secure and flexible deployment. Remember to replace 'YOUR_API_TOKEN' and 'YOUR_DATABASE' or set corresponding environment variables."},"warnings":[{"fix":"Remove the `org` parameter from client initialization or write calls.","message":"The `org` parameter, which was mandatory in InfluxDB 2.x and earlier `influxdb-client` versions, is no longer required or supported by `influxdb3-python`. Including it can lead to unexpected behavior or errors.","severity":"gotcha","affected_versions":"v0.13.0 and later"},{"fix":"Install the desired DataFrame library: `pip install 'influxdb3-python[pandas]'` or `pip install 'influxdb3-python[polars]'`.","message":"Using `write_dataframe()` or `query_dataframe()` methods requires either `pandas` or `polars` to be installed as optional dependencies. If these libraries are not installed, attempting to use these methods will raise an `ImportError`.","severity":"gotcha","affected_versions":"v0.17.0 and later"},{"fix":"Ensure `query_async()` is called as `await client.query_async(query)` within an `async def` function and an active `asyncio` event loop.","message":"The `query_async()` method (introduced in v0.12.0) is an `awaitable` coroutine. It must be called with `await` within an `async` function. Calling it directly without `await` will not execute the query and might lead to unexpected behavior or a `RuntimeWarning` if not awaited.","severity":"gotcha","affected_versions":"v0.12.0 and later"},{"fix":"Only set `WriteOptions.no_sync=True` when write performance is critical and some data loss upon server failure is acceptable. Otherwise, rely on the default `False` for durability.","message":"The `WriteOptions.no_sync` flag (introduced in v0.14.0) allows for faster writes by not waiting for Write-Ahead Log (WAL) persistence confirmation. While faster, data is not guaranteed to be durable if the server crashes immediately after the write. Default is `False`.","severity":"gotcha","affected_versions":"v0.14.0 and later"},{"fix":"Upgrade to `influxdb3-python` v0.18.0 or newer to ensure correct behavior with `write_file()` and `write_dataframe()` in batching mode.","message":"Prior to version 0.18.0, `InfluxDBClient3.write_file()` and `InfluxDBClient3.write_dataframe()` could fail when batching mode was enabled due to a bug. This was fixed in v0.18.0.","severity":"gotcha","affected_versions":"Prior to v0.18.0"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}