This is the official Python client library for QuestDB.
This client library implements QuestDB's variant of the InfluxDB Line Protocol (ILP) over HTTP and TCP.
ILP provides the fastest way to insert data into QuestDB.
This implementation supports authentication and full-connection encryption with TLS.
The latest version of the library is 2.0.0.
python3 -m pip install -U questdb
Please start by setting up QuestDB . Once set up, you can use this library to insert data.
from questdb.ingress import Sender, TimestampNanos
conf = f'http::addr=localhost:9000;'
with Sender.from_conf(conf) as sender:
sender.row(
'sensors',
symbols={'id': 'toronto1'},
columns={'temperature': 20.0, 'humidity': 0.5},
at=TimestampNanos.now())
sender.flush()
You can also send Pandas dataframes:
import pandas as pd
from questdb.ingress import Sender
df = pd.DataFrame({
'id': pd.Categorical(['toronto1', 'paris3']),
'temperature': [20.0, 21.0],
'humidity': [0.5, 0.6],
'timestamp': pd.to_datetime(['2021-01-01', '2021-01-02'])})
conf = f'http::addr=localhost:9000;'
with Sender.from_conf(conf) as sender:
sender.dataframe(df, table_name='sensors', at='timestamp')
To connect via TCP, set the configuration string to:
conf = f'tcp::addr=localhost:9009;'
with Sender.from_conf(conf) as sender:
...
You can continue by reading the Sending Data Over ILP guide.
If you need help, you can ask on Stack Overflow:
We monitor the #questdb
and #py-questdb-client
tags.
Alternatively, you may find us on Slack.
You can also sign up to our mailing list to get notified of new releases.
The code is released under the Apache License 2.0.