Skip to main content

opengemini-client-python

License Language version

English | 简体中文

opengemini-client-python is a Python client for OpenGemini

Design Doc

OpenGemini Client Design Doc

About OpenGemini

OpenGemini is a cloud-native distributed time series database, find more information here

Requirements

  • Python 3.9+

Usage

Install:

pip install opengemini_client

Getting Started:

from opengemini_client import Client, Config, Address

if __name__ == "__main__":
    config = Config(address=[Address(host='127.0.0.1', port=8086)])
    cli = Client(config)
    try:
        cli.ping(0)
        print("ping success")
    except Exception as error:
        print(f"ping failed, {error}")

Create a database:

from opengemini_client import Client, Config, Address

if __name__ == "__main__":
    config = Config(address=[Address(host='127.0.0.1', port=8086)])
    cli = Client(config)
    try:
        database = 'test'
        res = cli.create_database(database=database)
        if res.error is None:
            print(f"create database {database} success")
        else:
            print(f"create database {database} failed, {res.error}")
    except Exception as error:
        print(f"create database {database} failed, {error}")

Write points:

from opengemini_client import Client, Config, Address, Point, BatchPoints, Precision

if __name__ == "__main__":
    config = Config(address=[Address(host='127.0.0.1', port=8086)])
    cli = Client(config)
    try:
        database = 'test'
        measurement = 'test_measurement'
        point = Point(
            measurement=measurement,
            precision=Precision.PrecisionSecond,
            fields={'Humidity': 87, 'Temperature': 25},
            tags={'Weather': 'foggy'}
        )
        batch_points = BatchPoints(points=[point])
        cli.write_batch_points(database=database, batch_points=batch_points)
        print(f"write points success")
    except Exception as error:
        print(f"write points failed, {error}")

Do a query:

from opengemini_client import Client, Config, Address, Query

if __name__ == "__main__":
    config = Config(address=[Address(host='127.0.0.1', port=8086)])
    cli = Client(config)
    try:
        database = 'test'
        measurement = 'test_measurement'
        query = Query(
            database=database,
            command=f'select * from {measurement}',
            retention_policy=''
        )
        res = cli.query(query=query)
        if res.error is not None:
            print(f"query error, {res.error}")
        else:
            for result in res.results:
                if result.error is not None:
                    print(f"query result error, {result.error}")
                    continue
                for s in result.series:
                    print(f"name={s.name}, columns={s.columns}, values={s.values}")
    except Exception as error:
        print(f"query failed, {error}")

Metadata

Release files for opengemini-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opengemini-client 0.1.0
File Size Uploaded Provenance
opengemini_client-0.1.0.tar.gz 14.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opengemini-client 0.1.0
File Interpreter ABI Platform
opengemini_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / opengemini_client-0.1.0.tar.gz

Download URL opengemini_client-0.1.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f85f20ecc60ddb35519c47250ccd07b2496f136f3e94e714001d2a3aaf0cb86
BLAKE2b-256 checksum
How to use checksums
9efb781bc375fa307527497ac02e8f9cff210adaa3eba0c052b30e7034a6dc5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Release files / opengemini_client-0.1.0-py3-none-any.whl

Download URL opengemini_client-0.1.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f0194ec33f10faebefd50e6afbd02da08e1087ba620de8b760fd38b862e60d5
BLAKE2b-256 checksum
How to use checksums
a5d4410939577a8bedbe75dba0d5a348ec2b3facf4db103e867938b2ae193df2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.6

Security for opengemini-client 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page