Skip to main content

Community Python client for InfluxDB 3.0

Project description

Your Image

PyPI version PyPI downloads Lint Code Base Lint Code Base Community Slack

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-python

Usage

Importing the Module

from influxdb_client_3 import InfluxDBClient3, Point

Initialization

If you are using InfluxDB Cloud, then you should note that:

  1. You will need to supply your org id, this is not necessary for InfluxDB Dedicated.
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

influxdb3-python-0.1.4.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

influxdb3_python-0.1.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file influxdb3-python-0.1.4.tar.gz.

File metadata

  • Download URL: influxdb3-python-0.1.4.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for influxdb3-python-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4df6a94f947e80be7aa5682f609049d4c3e8d46d6ee90e33c256895912865930
MD5 7b5ca916eb36a1111d503b6ca612e052
BLAKE2b-256 1474e9c0c92008f86696a0d2c7c226539a3af12d496a01c95b2173ee356384db

See more details on using hashes here.

File details

Details for the file influxdb3_python-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for influxdb3_python-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03a36f30753adefaa1242bfa3ca2d1c44fb56a37d637345469d7d70ccb4a3f76
MD5 1ea751f4a48964da5d49a4066b6b8933
BLAKE2b-256 4690344fef0d926fde4430a47e9b69aefc83a8648aa43c0b4906035fa78396cb

See more details on using hashes here.

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