A query generator for the SQL dialect of the Influx Query Language (InfluxQL)
Project description
About
A query generator for the SQL dialect of the Influx Query Language (InfluxQL). Like SQLAlchemy but for InfluxDB. Consider this an experimental WIP.
Synopsis
from influxdb import InfluxDBClient
from pyinfluxql import Engine, Query, Mean
client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
engine = Engine(client)
query = Query(Mean('value')).from_('cpu_load') \
.where(time__gt=datetime.now() - timedelta(1))
.group_by(time=timedelta(hours=1))
engine.execute(query)
Tests
How to invoke the test suite.
Using Tox
Run InfluxDB within Docker:
docker run -it --rm --publish 8086:8086 influxdb:1.8.3
Run tox:
tox
Using sandbox
Alternatively, setup package in development mode:
python3 -mvenv .venv source .venv/bin/activate pip install --editable=.[test]
Run pytest:
pytest tests -vvv
Credits
Thanks a stack to the original author Jeremiah Malina for his excellent work as well as Michael Pérez for adding integration tests, timezone support and for improving the documentation.
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
pyinfluxql-0.1.2.tar.gz
(7.8 kB
view details)
File details
Details for the file pyinfluxql-0.1.2.tar.gz
.
File metadata
- Download URL: pyinfluxql-0.1.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd262cd0f81928a7340629f7319b2e001e93694e24335ab3fb782b4bab0c11e |
|
MD5 | 604dd653296de77a7870d14c439e5ad0 |
|
BLAKE2b-256 | ffd94012b1b65a782d945bb73bee8a63eb33482f7ef16fca8c7166cfa3d90269 |