Skip to main content

InfluxDB client, asyncio version

Project description

InfluxDB-Python-Aio


Statement

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)

Installation

Install, upgrade and uninstall influxdb-aio with these commands::

$ pip install influxdb-aio
$ pip install --upgrade influxdb-aio
$ pip uninstall influxdb-aio

Dependencies

The influxdb-python distribution is supported only on Python 3.6, 3.7, etc.

Main dependency is:

Examples


Here's a basic example (for more see the examples directory)

import asyncio
from influxdb_aio import InfluxDBClient


json_body = [
    {
        "measurement": "cpu_load_short",
        "tags": {
            "host": "server01",
            "region": "us-west"
        },
        "time": "2009-11-10T23:00:00Z",
        "fields": {
            "value": 0.64
        }
    }
]


async def init_client():
    client = await InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
    await client.create_database('example')
    return client.write_points(json_body)


async def main():
    client = await init_client()
    result = await client.query('select value from cpu_load_short;')
    print("Result: {0}".format(result))


if __name__ == '__main__' :
    asyncio.get_event_loop().run_until_complete(main())

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

influxdb-aio-5.3.2.tar.gz (65.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page