This was forked from (https://github.com/influxdata/influxdb-python), and support asyncio.
Here is the original README document. You can find more detail about InfluxDB-Python (client) and also influxdb (database). Here is only some difference and basic usage.
InfluxDB-Python is a client for interacting with InfluxDB_.
Development of this library is maintained by:
| Github ID | URL |
|---|---|
| @aviau | (https://github.com/aviau) |
| @xginn8 | (https://github.com/xginn8) |
| @sebito91 | (https://github.com/sebito91) |
Install, upgrade and uninstall influxdb-aio with these commands::
$ pip install influxdb-aio
$ pip install --upgrade influxdb-aio
$ pip uninstall influxdb-aio
The influxdb-python distribution is supported only on Python 3.6, 3.7, etc.
Main dependency is:
- httpx: A next generation HTTP client for Python. (https://github.com/encode/httpx)
Here's a basic example (for more see the examples directory)
importasynciofrominfluxdb_aioimportInfluxDBClientjson_body= [
{
"measurement": "cpu_load_short",
"tags": {
"host": "server01",
"region": "us-west"
},
"time": "2009-11-10T23:00:00Z",
"fields": {
"value": 0.64
}
}
]
asyncdefinit_client():
client=awaitInfluxDBClient('localhost', 8086, 'root', 'root', 'example')
awaitclient.create_database('example')
returnclient.write_points(json_body)
asyncdefmain():
client=awaitinit_client()
result=awaitclient.query('select value from cpu_load_short;')
print("Result: {0}".format(result))
if__name__=='__main__' :
asyncio.get_event_loop().run_until_complete(main())