Skip to main content

Python QuestDB ILP TCP client

Requirements

This repository contains a Python 3.9 API for ingesting data into QuestDB through the InfluxDB Line Protocol.

We use make as a CLI to various convenient work developer flows.

Install Flow

We require Python 3.9.*, or above installed in your system, and pip needs to be up-to-date:

$ python3 --version
$ Python 3.9.<some-integer>
$ pip3 install --upgrade pip

Now we can install the project's dependencies in a virtual environment and activate it:

$ make install-dependencies

Or for development (Required for code quality and test flows):

$ make install-dependencies-dev

To activate the environment:

$ poetry shell
$ echo $SHLVL
2

To deactivate the environment:

$ exit
$ echo $SHLVL
1

Code Quality Flow (Requires dev dependencies)

For convenience, we can let standard tools apply standard code formatting; the second command will report issues that need to be addressed before using the client in production environments.

$ make format-code
$ make check-code-quality

Test Flow (Requires dev dependencies)

To run all tests in the tests module:

$ make test

Start/stop QuestDB Docker container Flow

To start QuestDB:

$ make compose-up

This creates a folder questdb_root to store QuestDB's table data/metadata, server configuration files, and the web UI.

The Web UI is avaliable at: localhost:9000.

Logs can be followed on the terminal:

$ docker logs -f questdb

To stop QuestDB:

$ make compose-down

Data is available, even when QuestDB is down, in folder questdb_root.

Basic usage

with LineTcpSender(HOST, PORT, SIZE) as ls:
    ls.table("metric_name")
    ls.symbol("Symbol", "value")
    ls.column_int("number", 10)
    ls.column_float("double", 12.23)
    ls.column_str("string", "born to shine")
    ls.at_utc_datetime(datetime(2021, 11, 25, 0, 46, 26))
    ls.flush()

As an object

ls = LineTcpSender(HOST, PORT, SIZE)
ls.table("metric_name")
ls.symbol("Symbol", "value")
ls.column_int("number", 10)
ls.column_float("double", 12.23)
ls.column_str("string", "born to shine")
ls.at_utc_datetime(datetime(2021, 11, 25, 0, 46, 26))
ls.flush()

Multi-line send

with LineTcpSender(HOST, PORT, SIZE) as ls:
    for i in range(int(1e6)):
        ls.table("metric_name")
        ls.column_int("counter", i)
        ls.at_now()
    ls.flush()

Object multi-line send

ls = LineTcpSender(HOST, PORT, SIZE)
for i in range(int(1e6)):
    ls.table("metric_name")
    ls.column_int("counter", i)
    ls.at_now()
ls.flush()

Notes

  • On file setup.py: It is deprecated. To publish a package on PyPi you can follow this.

Metadata

Release files for questdb-ilp-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 questdb-ilp-client 0.1.0
File Size Uploaded
questdb_ilp_client-0.1.0.tar.gz 8.0 kB Details

Built distribution (wheel)

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

Total release size: 16.1 kB

Release files / questdb_ilp_client-0.1.0.tar.gz

Download URL questdb_ilp_client-0.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9e57616f55c916d56476b4100e88cd88ab7d3c5f5e4ef50d2200debde23e6e34
BLAKE2b-256 checksum
How to use checksums
0f80389f48a3b64a7910f0875d992a5a83dbfa0b8a63c385658e095ffcfc18da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.9 Darwin/19.6.0

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

Download URL questdb_ilp_client-0.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5172d3b5fd71ef60ff629ee6e7fd4be3c417732a0e9c20b52f84fef9fa34c603
BLAKE2b-256 checksum
How to use checksums
31b527c5e067e1c6b182b0700aee765c4fc0751b1991f9cff5e41af0edb54b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.9 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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