Registry / database / questdb

questdb

JSON →
library4.1.0pypypi✓ verified 82d ago

The `questdb` library is the official Python client for QuestDB, a high-performance open-source SQL database for time-series and analytics. It provides efficient ingestion of data via InfluxDB Line Protocol (ILP) over TCP or HTTP, supporting various Python data types, Pandas DataFrames, and NumPy arrays. The current version is 4.1.0, and releases are typically feature-driven, often aligning with new QuestDB server capabilities.

pip install questdb
INSTALL
IMPORT
SIG · QUESTDB
Q
questdb
databasepythonv4.1.0
Install
3.7s avg
Import
Disk
109MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 3.9s
py 3.11
✓ —
✓ 3.75s
py 3.12
✓ —
✓ 3.45s
py 3.13
✓ —
✓ 3.6s
py 3.9
✕ build_error
✕ build_error
109MB installed
● package 109MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Sender
import questdb
from questdb import Sender

This quickstart demonstrates how to initialize the `Sender` using a configuration string for ILP over HTTP and ingest two rows of data. It also highlights the support for nanosecond precision timestamps introduced in version 4.0.0. The connection details can be configured via environment variables for easy deployment.

import os import time from questdb.client import Sender from datetime import datetime, timezone # Configure QuestDB connection (ILP over HTTP) # Use os.environ.get for security and flexibility in deployment QDB_HOST = os.environ.get("QDB_HOST", "localhost") QDB_PORT = os.environ.get("QDB_PORT", "9000") QDB_AUTH = os.environ.get("QDB_AUTH", "") # Format: "username:token" conf = f'http::addr={QDB_HOST}:{QDB_PORT};' if QDB_AUTH: conf += f'auth={QDB_AUTH};' # Assumes auth syntax for QuestDB 7.0+ else: print("Warning: QDB_AUTH environment variable not set. Connecting without authentication.") try: with Sender.from_conf(conf) as sender: # Ingest a single row of data sender.row( "sensor_data", columns={ "location": "london", "temperature": 15.5, "humidity": 70, "event_time": datetime.now(timezone.utc) }, at=datetime.now(timezone.utc) # QuestDB timestamp column ) # Ingest another row, demonstrating nanosecond precision (client v4.0.0+) # Note: Requires QuestDB server 9.1.0+ for nanosecond TIMESTAMP_NS type nanos_timestamp = int(time.time_ns()) # Current time in nanoseconds sender.row( "sensor_data", columns={ "location": "paris", "temperature": 18.2, "humidity": 65, "event_time": datetime.now(timezone.utc) }, at=nanos_timestamp # This sends nanosecond precision ) sender.flush() # Ensure all buffered data is sent print("Data sent successfully to QuestDB!") except Exception as e: print(f"Failed to send data: {e}") print(f"Please ensure QuestDB server is running and accessible at http://{QDB_HOST}:{QDB_PORT}")
Debug
Known issues
breakingVersion 4.0.0 introduced support for nanosecond precision timestamps via the `.row()` API. While it enhances precision, users relying on older QuestDB servers (pre-9.1.0) might encounter issues or loss of precision if sending nanoseconds to `TIMESTAMP` columns, which only support microsecond precision. For full nanosecond support, QuestDB 9.1.0+ is required with `TIMESTAMP_NS` columns.
fix
Ensure QuestDB server is 9.1.0+ to fully utilize nanosecond precision with `TIMESTAMP_NS` columns. For older servers, be mindful of timestamp precision or convert to microseconds before sending.
affects: >=4.0.0
breakingVersion 3.0.0 introduced support for n-dimensional NumPy arrays and a new protocol version (2) for this feature. This requires QuestDB server 9.0.0 or higher. Attempting to send array data to older QuestDB servers will not work.
fix
Upgrade QuestDB server to 9.0.0+ to enable n-dimensional array ingestion. Ensure NumPy arrays are of `float64` dtype.
affects: >=3.0.0
breakingVersion 2.0.0 was a major release introducing ILP over HTTP, which became the preferred method for sending data due to better error feedback. If migrating from v1.x (TCP-only), connection configurations (`Sender.from_conf()`) and error handling (e.g., `IngressError`) will need to be updated.
fix
Review `Sender.from_conf()` arguments for HTTP configuration and update error handling to catch `IngressError` for server-side errors.
affects: >=2.0.0
gotchaVersion 4.1.0 added support for `decimal.Decimal` objects. This feature requires QuestDB server 9.2.0 or newer to correctly handle the native `DECIMAL(precision, scale)` column type. Sending decimals to older server versions will likely result in type errors or incorrect ingestion.
fix
Upgrade QuestDB server to 9.2.0+ to use the `DECIMAL` data type. If using an older server, convert `decimal.Decimal` objects to `float` or `string` before sending, mindful of potential precision loss.
affects: >=4.1.0
gotchaIn versions 2.0.0 and 2.0.1, the `auto_flush_rows` default for HTTPS connections was incorrectly set to a low value (600 rows), leading to suboptimal performance due to frequent flushes. This was fixed in v2.0.2.
fix
Upgrade to `questdb>=2.0.2` or explicitly set a higher `auto_flush_rows` value (e.g., 75000) when initializing the `Sender` for HTTPS connections.
affects: 2.0.0, 2.0.1
Upgrade
Version history
4.1.0latest on PyPI · released Nov 28, 2025
Audit
Dependencies
numpyoptionalRequired for ingesting n-dimensional NumPy arrays into QuestDB.
pandasoptionalRequired for high-performance ingestion of Pandas DataFrames.
pyarrowoptionalProvides improved performance when ingesting Pandas DataFrames containing Decimal types.
Agent activity
30 hits · last 30 days
node
28
Resources
questdb — pip install questdb · libregistry