Skip to main content

A simple python interface for InfluxDB2.0

Project description

SFLUX

Simple Influx DB wrapper for python. Builds on top of influxdb-client to make the use of Influxdb as simple as possible

Basic Usage

1. Querying data

Sflux transforms the FluxQL syntaxis into intuitive python commands that try to follow FluxQL as close as possible. A simple query looks like this:

import sflux

with sflux.Client(url='your_host', token='your_token', org='your_org') as client:
    result = client.query(bucket='your_bucket')\
        .range(start='-1d')\
        .filter(sflux.ROW('_measurement') == 'your_measurement')\
        .pivot()\
        .filter(sflux.ROW('your_column') != 'something')\
        .to_dict()

2. Writing data

The writing of time series into the database is acheived by building measurement objects for each measurement to be inserted:

import time
import sflux

measurements = [
    sflux.Measurement('measurement_name', field1='value1', field2='value2')
        .tags(tag1='tag1', tag2='tag2')
        .time(time.time())
]
with sflux.Client(url='your_host', token='your_token', org='your_org') as client:
    client.write('your_bucket', measurements)

3. Usage considerations

This library is still under development and should be used with care. Please report any bugs as issues and they will be addressed promptly.

For now Sflux does not implement string checks to avoid Injections. Please always verify any user input before passing it to Sflux. String checking will be implemented in future releases.

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

sflux-0.0.32.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

sflux-0.0.32-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file sflux-0.0.32.tar.gz.

File metadata

  • Download URL: sflux-0.0.32.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for sflux-0.0.32.tar.gz
Algorithm Hash digest
SHA256 81bfc21805c8eb011ba6983a24bd6ea779595c64570c22818270509f4e842a42
MD5 68c8a811a2bc76108a12e7436d260504
BLAKE2b-256 aeb4e4d1682942e326cc711187f52a59f594754ba72c552fe4bd31602ae50be8

See more details on using hashes here.

File details

Details for the file sflux-0.0.32-py3-none-any.whl.

File metadata

  • Download URL: sflux-0.0.32-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for sflux-0.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 4c0045c53fe7e9bed472f3fc15c5be6a4cec73940c71842c3308e3b1fb442ca6
MD5 859e7603aa66b0a33c0dd8f3df3b420c
BLAKE2b-256 f3ac49de0f87108c82fd695d0e00a5867ec8ca4fd1564500bb691f87a77e64cb

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