Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Python3 API for ingesting data into QuestDB through the InfluxDB Line Protocol.

License

NotificationsYou must be signed in to change notification settings

nsco1/py-questdb-client

Repository files navigation

Requirements

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

We usemake as a CLI to various convenient work developer flows.We usepoetry to manage dependencies.

Install Flow

We requirePython 3.9.*, or above installed in your system, withpip up-to-date, as well aspoetry:

$ python3 --version$ Python 3.9.<some-integer>$ pip3 install --upgrade pip$ curl -sSL https://install.python-poetry.org| python3 -

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$SHLVL2

To deactivate the environment:

$exit$echo$SHLVL1

Code Quality Flow (Requires dev dependencies)

For convenience, we can let standard tools apply standard code formatting; the second command will reportissues 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 thetests module:

$ maketest

Note: QuestDB must be running, see next section.

Start/stop QuestDB Docker container Flow

To start QuestDB:

$ make compose-up

This creates a folderquestdb_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 are available, even when QuestDB is down, in folderquestdb_root.

Basic usage

fromdatetimeimportdatetimefromquestdb_ilp_client.tcpimportLineTcpSender# Single line sendwithLineTcpSender(host_name="localhost",port=9009,buffer_size=4096)asls: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(2022,4,23,0,46,26))ls.flush()# Multiple line sendwithLineTcpSender(host_name="localhost",port=9009,buffer_size=4096)asls:foriinrange(int(1e6)):ls.table("metric_name")ls.column_int("counter",i)ls.at_now()ls.flush()

About

A Python3 API for ingesting data into QuestDB through the InfluxDB Line Protocol.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp