influxdb python client working with asyncio
Project description
aio-influx
influxdb python client working with asyncio
Install
pip install aioinflux3
Initialize asynchronous client
from aioinflux3 import InfluxClient, Measurement, Query, Field
async with InfluxClient(host=..., port=..., org=..., token=...) as client:
# write code here
Write data
async with InfluxClient(host=..., port=..., org=..., token=...) as client:
await client.write(Measurement.new('measurement',
timestamp,
tag=[Field(key=tag key,
val=tag value), ],
fields=[
Field(key=filed key,
val=field value),
]
)
)
Make Query
async with InfluxClient(host=..., port=..., org=..., token=...) as client:
query = Query(bucket name, measurement=measurement name)
.range(start='-4h', end='-1s')
.filter('_field name', tag name= tag value)
.window(every='5s', fn='func name') # func name in next list
.do_yield(name='func name') # name if optional
resp = await client.query(query) # return json table
resp = await client.query(query, numpy=True) # return a numpy Structured Array
func list:
- mean
- median
- max
- min
- sum
- derivative
- distinct
- count
- increase
- skew
- spread
- stddev
- first
- last
- unique
- sort
- nonnegative derivative1
Notice
This project started for own useage. My goal is make it simple and easy to use, it's not full functional for InfluxDB v2 API. If you like it, Pls star, and tell me yourneeds in issuse, I will try my best to make it happen.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioinflux3-0.0.5.tar.gz
(5.4 kB
view details)
File details
Details for the file aioinflux3-0.0.5.tar.gz
.
File metadata
- Download URL: aioinflux3-0.0.5.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2186fec37c2fec3f4aac9c8cd872895928b2b5c23b40014191f0680e506ec46d |
|
MD5 | 45ffd04cfee5caab7e1e968bc4dce0b5 |
|
BLAKE2b-256 | 70e070f009eab8aba3976af79491e175f210cbc5059af1e0a1a1d57c60948805 |