Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "4.0.0"
current_version = "4.1.0"
commit = false
tag = false

Expand Down
130 changes: 130 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,136 @@ Changelog

=========

4.1.0 (2025-11-28)
------------------

Features
~~~~~~~~

Decimal Data Type Support
*************************

This release adds support for ingesting data into QuestDB's native
``DECIMAL(precision, scale)`` column type introduced in QuestDB 9.2.0.
Use decimals when you need exact-precision values (e.g. prices, balances)
without floating-point rounding issues.

Decimal values can be sent using Python ``decimal.Decimal`` objects in both
``row()`` and ``dataframe()`` methods. When sending dataframes, you can also use
PyArrow decimal types for better performance.

Sending decimals requires protocol version 3. When using HTTP, this protocol
version is auto-negotiated. For TCP connections, you must explicitly specify
``protocol_version=3`` in the configuration string:

.. code-block:: python

# HTTP - protocol version 3 is auto-negotiated
conf = 'http::addr=localhost:9000;'

# TCP - must specify protocol_version=3 explicitly
conf = 'tcp::addr=localhost:9009;protocol_version=3;'

.. important::
**Server Requirement**: This feature requires QuestDB server version 9.2.0 or higher.

Unlike other column types, DECIMAL columns **must be created in advance** via SQL
before ingesting data. Auto-creation is not supported for DECIMAL columns.

For details on creating DECIMAL columns and working with this data type, see the
`QuestDB Decimal documentation <https://questdb.com/docs/concept/decimal/>`_.

**Usage with Python Decimal objects:**

.. code-block:: python

from decimal import Decimal
from questdb.ingress import Sender, TimestampNanos

# First, create the table with DECIMAL column via SQL:
# CREATE TABLE trades (
# symbol SYMBOL,
# price DECIMAL(18,4),
# amount DECIMAL(18,8),
# timestamp TIMESTAMP
# ) TIMESTAMP(timestamp);

conf = 'http::addr=localhost:9000;'
with Sender.from_conf(conf) as sender:
sender.row(
'trades',
symbols={'symbol': 'ETH-USD'},
columns={
'price': Decimal('2615.5400'),
'amount': Decimal('0.00044000')},
at=TimestampNanos.now())

**Usage with Python Decimal objects in Pandas dataframes:**

.. code-block:: python

import pandas as pd
from decimal import Decimal

# Create DataFrame with Python Decimal objects
df = pd.DataFrame({
'symbol': ['ETH-USD', 'BTC-USD'],
'price': [Decimal('2615.5400'), Decimal('43210.1234')],
'volume': [Decimal('1234.56789012'), Decimal('98.76543210')]
})

with Sender.from_conf(conf) as sender:
sender.dataframe(
df,
table_name='trades',
symbols='symbol',
at=TimestampNanos.now())

**Usage with PyArrow Decimal types in Pandas dataframes:**

.. code-block:: python

import pandas as pd
import pyarrow as pa
from decimal import Decimal

# Create DataFrame with Arrow decimal types
df = pd.DataFrame({
'prices': pd.array(
[Decimal('-99999.99'), Decimal('-678.00')],
dtype=pd.ArrowDtype(pa.decimal128(18, 2))
)
})

with Sender.from_conf(conf) as sender:
sender.dataframe(df, table_name='prices', at=TimestampNanos.now())

Additional Arrow Data Type Support
**********************************

Added support for additional PyArrow column types commonly encountered when
deserializing from Parquet files or converting Polars dataframes to Pandas:

* ``int16``, ``int32``, ``float32`` (float), ``bool``
* ``string``, ``large_string`` (including as symbol types)
* ``timestamp[us]`` with timezone support for microsecond-precision timestamps

Microsecond Timestamp Precision
*******************************

Microsecond-precision timestamp columns (``datetime64[us]`` in NumPy and
``timestamp[us]`` in PyArrow) are now fully supported. When using
``protocol_version`` 2 or higher, microsecond timestamps are sent with full
precision, including for the designated timestamp column.

Bug fixes
~~~~~~~~~

* Updated type hints to allow ``None`` as a valid column value in
``Sender.row()``. This brings the type annotations in line with the actual
behavior, where ``None`` values have always been supported to represent NULL
values.

4.0.0 (2025-10-17)
------------------

Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
QuestDB Client Library for Python
=================================

This is the official Python client library for `QuestDB <https://questdb.io>`_.
This is the official Python client library for `QuestDB <https://questdb.com>`_.

This client library implements QuestDB's variant of the
`InfluxDB Line Protocol <https://questdb.io/docs/reference/api/ilp/overview/>`_
`InfluxDB Line Protocol <https://questdb.com/docs/reference/api/ilp/overview/>`_
(ILP) over HTTP and TCP.

ILP provides the fastest way to insert data into QuestDB.
Expand All @@ -18,7 +18,7 @@ and full-connection encryption with
Install
=======

The latest version of the library is 4.0.0 (`changelog <https://py-questdb-client.readthedocs.io/en/latest/changelog.html>`_).
The latest version of the library is 4.1.0 (`changelog <https://py-questdb-client.readthedocs.io/en/latest/changelog.html>`_).

::

Expand All @@ -27,7 +27,7 @@ The latest version of the library is 4.0.0 (`changelog <https://py-questdb-clien
Quickstart
==========

Start by `setting up QuestDB <https://questdb.io/docs/quick-start/>`_ .
Start by `setting up QuestDB <https://questdb.com/docs/quick-start/>`_ .
Once set up, you can use this library to insert data.

The most common way to insert data is from a Pandas dataframe.
Expand Down Expand Up @@ -98,7 +98,7 @@ guide.
Links
=====

* `Core database documentation <https://questdb.io/docs/>`_
* `Core database documentation <https://questdb.com/docs/>`_

* `Python library documentation <https://py-questdb-client.readthedocs.io/>`_

Expand All @@ -109,10 +109,10 @@ Links
Community
=========

Stop by our `Community Forum <https://community.questdb.io>`_ to
Stop by our `Community Forum <https://community.questdb.com>`_ to
chat with the QuestDB team.

You can also `sign up to our mailing list <https://questdb.io/contributors/>`_
You can also `sign up to our mailing list <https://questdb.com/contributors/>`_
to get notified of new releases.


Expand Down
11 changes: 11 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
.. _changelog:

=========
Changelog
=========

.. contents::
:local:
:depth: 1

.. include:: ../CHANGELOG.rst
:start-line: 7
4 changes: 2 additions & 2 deletions docs/community.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Chat to us
==========

If you want to engage with us to discuss your changes or if you need help,
there's a `#contributors` channel on our `slack <http://slack.questdb.io>`_ server
there's a `#contributors` channel on our `slack <http://slack.questdb.com>`_ server
just for that.

Asking for help
Expand All @@ -46,4 +46,4 @@ We monitor the `questdb` tag and will get back to you.
Stack overflow helps us to keep track of the questions and answers, and it helps
other users who might have the same question.

Alternatively, you can ask on our `slack <http://slack.questdb.io>`_ server.
Alternatively, you can ask on our `slack <http://slack.questdb.com>`_ server.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
year = '2024'
author = 'QuestDB'
copyright = '{0}, {1}'.format(year, author)
version = release = '4.0.0'
version = release = '4.1.0'

github_repo_url = 'https://github.com/questdb/py-questdb-client'

Expand Down
13 changes: 9 additions & 4 deletions docs/conf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Authentication
==============

If you're using QuestDB enterprise you can read up on creating and permissioning
users in the `Enterprise quickstart <https://questdb.io/docs/guides/enterprise-quick-start/#4-ingest-data-influxdb-line-protocol>`_
and the `role-based access control <https://questdb.io/docs/operations/rbac/>`_ guides.
users in the `Enterprise quickstart <https://questdb.com/docs/guides/enterprise-quick-start/#4-ingest-data-influxdb-line-protocol>`_
and the `role-based access control <https://questdb.com/docs/operations/rbac/>`_ guides.

HTTP Bearer Token
-----------------
Expand Down Expand Up @@ -106,7 +106,7 @@ TLS

TLS in enabled by selecting the ``tcps`` or ``https`` protocol.

See the `QuestDB enterprise TLS documentation <https://questdb.io/docs/operations/tls/>`_
See the `QuestDB enterprise TLS documentation <https://questdb.com/docs/operations/tls/>`_
on how to enable this feature in the server.

Open source QuestDB does not offer TLS support out of the box, but you can
Expand Down Expand Up @@ -154,7 +154,7 @@ For more details on using self-signed test certificates, see:

* For Open Source QuestDB: https://github.com/questdb/c-questdb-client/blob/main/tls_certs/README.md#self-signed-certificates

* For QuestDB Enterprise: https://questdb.io/docs/operations/tls/#demo-certificates
* For QuestDB Enterprise: https://questdb.com/docs/operations/tls/#demo-certificates

.. _sender_conf_auto_flush:

Expand Down Expand Up @@ -239,6 +239,8 @@ Valid options are:

* ``2`` - Array support and binary format serialization for 64-bit floats (version specific to QuestDB).

* ``3`` - Decimal type support (requires QuestDB 9.2.0+). Also includes all features from version 2.

* ``auto`` (default) - Automatic version selection based on protocol type.

HTTP/HTTPS: Auto-detects server capability during handshake (supports version negotiation)
Expand All @@ -247,6 +249,9 @@ Valid options are:

.. note::
Protocol version ``2`` requires QuestDB server version 9.0.0 or higher.

Protocol version ``3`` requires QuestDB server version 9.2.0 or higher and
is needed for ingesting data into ``DECIMAL`` columns.

.. _sender_conf_buffer:

Expand Down
41 changes: 41 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,44 @@ name.

For details on all options, see the
:func:`Buffer.dataframe <questdb.ingress.Buffer.dataframe>` method.


Decimal Types (QuestDB 9.2.0+)
------------------------------

The following example shows how to insert data with decimal precision using
Python's :class:`decimal.Decimal` type.

Requires QuestDB server 9.2.0+ and :ref:`protocol version 3 <sender_conf_protocol_version>`
(must be :ref:`configured explicitly for TCP/TCPS <sender_conf_protocol_version>`).
``DECIMAL`` columns must be :ref:`pre-created <sender_auto_creation>` (auto-creation not supported).
See the :ref:`troubleshooting guide <troubleshooting-flushing>` for common errors.

First, create the table with ``DECIMAL`` columns:

.. code-block:: sql

CREATE TABLE financial_data (
symbol SYMBOL,
price DECIMAL(18, 6),
quantity DECIMAL(12, 4),
timestamp TIMESTAMP_NS
) TIMESTAMP(timestamp) PARTITION BY DAY;

Then insert data using Python decimals:

.. literalinclude:: ../examples/decimal.py
:language: python

For better performance with DataFrames, use PyArrow decimal types:

.. literalinclude:: ../examples/decimal_arrow.py
:language: python

.. note::

For HTTP/HTTPS, protocol version 3 is auto-negotiated.
For TCP/TCPS, explicitly configure: ``tcp::addr=localhost:9009;protocol_version=3;``

For more details, see the
`QuestDB DECIMAL documentation <https://questdb.com/docs/reference/sql/datatypes/#decimal>`_.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. image:: logo.svg
:target: https://questdb.io/
:target: https://questdb.com/
:alt: QuestDB
:width: 400px

Expand All @@ -9,7 +9,7 @@ Contents
========

.. toctree::
:maxdepth: 2
:maxdepth: 1

installation
sender
Expand Down
Loading