Community Python client for InfluxDB 3.0
Project description
InfluxDB 3.0 Python Client
Introduction
influxdb_client_3
is a Python module that provides a simple and convenient way to interact with InfluxDB 3.0. This module supports both writing data to InfluxDB and querying data using the Flight client, which allows you to execute SQL and InfluxQL queries on InfluxDB 3.0.
Dependencies
pyarrow
influxdb-client
Installation
You can install the dependencies using pip
:
pip install influxdb3-client
Usage
Importing the Module
from influxdb_client_3 import InfluxDBClient3, Point
Initialization
If you are using InfluxDB Cloud, then you should note that:
- You will need to supply your org id, this is not necessary for InfluxDB Dedicated.
- Use a bucketname for the database argument.
client = InfluxDBClient3(token="your-token",
host="your-host",
org="your-org",
database="your-database")
Writing Data
You can write data using the Point class, or supplying line protocol.
Using Points
point = Point("measurement").tag("location", "london").field("temperature", 42)
client.write(point)
Using Line Protocol
point = "measurement fieldname=0"
client.write(point)
Querying with SQL
query = "select * from measurement"
reader = client.query(query=query, language="sql")
table = reader.read_all()
print(table.to_pandas().to_markdown())
Querying with influxql
query = "select * from measurement"
reader = client.query(query=query, language="influxql")
table = reader.read_all()
print(table.to_pandas().to_markdown())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file influxdb3-python-0.0.0.tar.gz
.
File metadata
- Download URL: influxdb3-python-0.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 374a2a187f2ed98446e236adf90653fb85fa8ab5bef181a65cc64cd527dba456 |
|
MD5 | 1d39afbae67d0579e1f5c20170f3d4d2 |
|
BLAKE2b-256 | e8696d4a47a750d6510e33341d93f3db1ce083e43619097bf6852c1b834dda12 |
File details
Details for the file influxdb3_python-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: influxdb3_python-0.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c52f566d6a5abb4690b46360277eba3fa0c16813745d9d5411005a888990196 |
|
MD5 | 3d1dbbe774da1dd28d52b862bd206060 |
|
BLAKE2b-256 | 2195163b55b626026140abcc6a49d06a30950ca147d35d5121c358a9f022fc72 |