Skip to content

Stabilising changes for version 3.0.0 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
28 changes: 0 additions & 28 deletions .bumpversion.cfg

This file was deleted.

39 changes: 39 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[tool.bumpversion]
current_version = "3.0.0"
commit = false
tag = false

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "setup.py"
search = "version='{current_version}'"
replace = "version='{new_version}'"

[[tool.bumpversion.files]]
filename = "README.rst"
search = "library is {current_version}"
replace = "library is {new_version}"

[[tool.bumpversion.files]]
filename = "docs/conf.py"
search = "version = release = '{current_version}'"
replace = "version = release = '{new_version}'"

[[tool.bumpversion.files]]
filename = "src/questdb/__init__.py"
search = "__version__ = '{current_version}'"
replace = "__version__ = '{new_version}'"

[[tool.bumpversion.files]]
filename = "src/questdb/ingress.pyx"
search = "VERSION = '{current_version}'"
replace = "VERSION = '{new_version}'"

[[tool.bumpversion.files]]
filename = ".bumpversion.toml"
search = "current_version = \"{current_version}\""
replace = "current_version = \"{new_version}\""
68 changes: 68 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,70 @@ Changelog

=========

3.0.0 (2025-xx-xx)
------------------

Features
~~~~~~~~

This is the first major release of the QuestDB Python client library
which supports n-dimensional arrays of doubles for QuestDB servers 8.4.0 and up.

.. code-block:: python

import numpy as np

# Create 2D numpy array
array_2d = np.array([
[1.1, 2.2, 3.3],
[4.4, 5.5, 6.6]], dtype=np.float64)

sender.row(
'table',
columns={'array_2d': array_2d},
at=timestamp)

The array data is sent over a new protocol version (2) that is auto-negotiated
when using HTTP(s), or can be specified explicitly via the ``protocol_version=2``
parameter when using TCP(s).

We recommend using HTTP(s), but here is an TCP example, should you need it::

tcp::addr=localhost:9009;protocol_version=2;

When using ``protocol_version=2`` (with either TCP(s) or HTTP(s)), the sender
will now also serialize ``float`` (double-precision) columns as binary.
You might see a performance uplift if this is a dominant data type in your
ingestion workload.

When compared to 2.0.4, this release includes all the changes from 3.0.0rc1 and
additionally:

* Has optimised ingestion performance from C-style contiguous NumPy arrays.

* Warns at most every 10 minutes when burst of reconnections are detected.
This is to warn about code patterns that may lead to performance issues, such as

.. code-block:: python

# Don't do this! Sender objects should be reused.
for row_fields in data:
with Sender.from_conf(conf) as sender:
sender.row(**row_fields)

This feature can be disabled in code by setting:

.. code-block:: python

import questdb.ingress as qi
qi.WARN_HIGH_RECONNECTS = False

Breaking Changes
~~~~~~~~~~~~~~~~
Refer to the release notes for 3.0.0rc1 for the breaking changes introduced
in this release compared to 2.x.x.


3.0.0rc1 (2025-06-02)
---------------------

Expand All @@ -16,6 +80,10 @@ Features
* Array Data Type Support. Adds native support for NumPy arrays
(currently only for ``np.float64`` element type and up to 32 dimensions).

.. note::
**Server Requirement**: This feature requires QuestDB server version 8.4.0 or higher.
Ensure your server is upgraded before ingesting array types, otherwise data ingestion will fail.

.. code-block:: python

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion DEV_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ The development requirements are these if you prefer to install them one by one:
python3 -m pip install wheel
python3 -m pip install twine
python3 -m pip install cibuildwheel
python3 -m pip install bump2version


Building and packaging
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ recursive-include src *.py
recursive-include src *.md
recursive-include src *.pxi
recursive-include src *.c
graft pystr-to-utf8
graft rpyutils
graft c-questdb-client
prune c-questdb-client/src/tests/json_tests.rs
prune c-questdb-client/.git
Expand Down
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ QuestDB Client Library for Python
This is the official Python client library for `QuestDB <https://questdb.io>`_.

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

ILP provides the fastest way to insert data into QuestDB.
Expand Down Expand Up @@ -53,6 +53,7 @@ The most common way to insert data is from a Pandas dataframe.
'amount': [0.00044, 0.001],

# NumPy float64 arrays are supported from v3.0.0rc1 onwards.
# Note that requires QuestDB server >= 8.4.0 for array support
'ord_book_bids': [
np.array([2615.54, 2618.63]),
np.array([39269.98, 39270.00])
Expand Down Expand Up @@ -82,6 +83,7 @@ You can also send individual rows. This only requires a more minimal installatio
'amount': 0.00044,

# NumPy float64 arrays are supported from v3.0.0rc1 onwards.
# Note that requires QuestDB server >= 8.4.0 for array support
'ord_book_bids': np.array([2615.54, 2618.63]),
},
at=TimestampNanos.now())
Expand Down
20 changes: 8 additions & 12 deletions RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ Create a new PR with the new changes in ``CHANGELOG.rst``.

Make a commit and push the changes to a new branch.

You also want to bump the version.
You also want to bump the version. This process is semi-automated.

This process is automated by the following command:
* Ensure you have `uv` and `bump-my-version` installed:
* `curl -LsSf https://astral.sh/uv/install.sh | sh` : see https://docs.astral.sh/uv/getting-started/installation/
* `uv tool install bump-my-version`: see https://github.com/callowayproject/bump-my-version.

.. code-block:: bash

bump2version --config-file .bumpversion.cfg --no-tag patch

Here use:

* ``patch`` to bump the version to the next patch version, e.g. 1.0.0 -> 1.0.1

* ``minor`` to bump the version to the next minor version, e.g. 1.0.0 -> 1.1.0
```console
bump-my-version replace --new-version NEW_VERSION
```

* ``major`` to bump the version to the next major version, e.g. 1.0.0 -> 2.0.0
If you're unsure, append `--dry-run` to preview changes.

Now merge the PR with the title "Bump version: V.V.V → W.W.W".

Expand Down
2 changes: 1 addition & 1 deletion c-questdb-client
Submodule c-questdb-client updated 51 files
+0 −28 .bumpversion.cfg
+49 −0 .bumpversion.toml
+10 −1 CMakeLists.txt
+8 −5 README.md
+7 −0 ci/format_cpp.py
+2 −2 ci/run_all_tests.py
+4 −4 ci/run_tests_pipeline.yaml
+188 −32 cpp_test/test_line_sender.cpp
+19 −4 doc/C.md
+20 −4 doc/CPP.md
+0 −21 doc/DEV_NOTES.md
+8 −8 doc/RELEASING.md
+2 −2 doc/SECURITY.md
+10 −6 examples/concat.c
+2 −1 examples/concat.h
+11 −8 examples/line_sender_c_example.c
+9 −4 examples/line_sender_c_example_array_byte_strides.c
+101 −0 examples/line_sender_c_example_array_c_major.c
+9 −4 examples/line_sender_c_example_array_elem_strides.c
+14 −8 examples/line_sender_c_example_auth.c
+16 −9 examples/line_sender_c_example_auth_tls.c
+6 −6 examples/line_sender_c_example_from_conf.c
+4 −4 examples/line_sender_c_example_from_env.c
+8 −6 examples/line_sender_c_example_http.c
+22 −11 examples/line_sender_c_example_tls_ca.c
+13 −1 examples/line_sender_cpp_example_array_byte_strides.cpp
+67 −0 examples/line_sender_cpp_example_array_c_major.cpp
+159 −0 examples/line_sender_cpp_example_array_custom.cpp
+13 −1 examples/line_sender_cpp_example_array_elem_strides.cpp
+87 −40 include/questdb/ingress/line_sender.h
+419 −38 include/questdb/ingress/line_sender.hpp
+2 −2 questdb-rs-ffi/Cargo.lock
+1 −1 questdb-rs-ffi/Cargo.toml
+170 −60 questdb-rs-ffi/src/lib.rs
+637 −190 questdb-rs-ffi/src/ndarr.rs
+2 −2 questdb-rs/Cargo.toml
+42 −27 questdb-rs/README.md
+1 −0 questdb-rs/examples/basic.rs
+1 −0 questdb-rs/examples/http.rs
+2 −1 questdb-rs/examples/protocol_version.rs
+2 −8 questdb-rs/src/error.rs
+4 −4 questdb-rs/src/ingress/http.rs
+17 −1 questdb-rs/src/ingress/mod.md
+64 −45 questdb-rs/src/ingress/mod.rs
+18 −18 questdb-rs/src/ingress/ndarr.rs
+80 −7 questdb-rs/src/tests/http.rs
+6 −2 questdb-rs/src/tests/mock.rs
+4 −4 questdb-rs/src/tests/ndarr.rs
+72 −0 questdb-rs/src/tests/sender.rs
+42 −3 system_test/questdb_line_sender.py
+11 −1 system_test/test.py
1 change: 1 addition & 0 deletions ci/cibuildwheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ stages:
displayName: Build wheels
env:
CIBW_BUILD: pp*
CIBW_ENABLE: pypy pypy-eol
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}

Expand Down
4 changes: 1 addition & 3 deletions ci/pip_install_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def main(args):
import pandas
import numpy
import pyarrow
if (sys.version_info >= (3, 8) and sys.version_info < (3, 13)):
# As of this commit, fastparquet does not have a binary built for 3.13
import fastparquet
import fastparquet


if __name__ == "__main__":
Expand Down
50 changes: 50 additions & 0 deletions ci/run_tests_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ stages:
lfs: false
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
- script: |
python3 --version
python3 -m pip install cython
Expand Down Expand Up @@ -68,3 +70,51 @@ stages:
JAVA_HOME: $(JAVA_HOME_11_X64)
QDB_REPO_PATH: './questdb'
condition: eq(variables.vsQuestDbMaster, true)
- job: TestsAgainstVariousNumpyVersion1x
pool:
name: "Azure Pipelines"
vmImage: "ubuntu-latest"
timeoutInMinutes: 45
steps:
- checkout: self
fetchDepth: 1
lfs: false
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'
- script: |
python3 --version
python3 -m pip install uv
sudo apt-get install -y libopenblas-dev pkg-config
displayName: "Install uv"
- script: uv run --with 'numpy==1.21.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 1.21"
- script: uv run --with 'numpy==1.24.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 1.24"
- script: uv run --with 'numpy==1.26.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 1.26"
- job: TestsAgainstVariousNumpyVersion2x
pool:
name: "Azure Pipelines"
vmImage: "ubuntu-latest"
timeoutInMinutes: 45
steps:
- checkout: self
fetchDepth: 1
lfs: false
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- script: |
python3 --version
python3 -m pip install uv
sudo apt-get install -y libopenblas-dev pkg-config
displayName: "Install uv"
- script: uv run --with 'numpy==2.0.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 2.0"
- script: uv run --with 'numpy==2.2.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 2.2"
- script: uv run --with 'numpy==2.3.0' test/test.py -v TestBufferProtocolVersionV2
displayName: "Test vs numpy 2.3"
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ sphinx-rtd-theme>=1.0.0
twine>=4.0.1
bump2version>=1.0.1
pandas>=1.3.5
numpy>=1.21.6
numpy>=1.21.0
pyarrow>=10.0.1
fastparquet>=2023.10.1
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

from questdb.ingress import *

autodoc_mock_imports = ["_cython"]
autodoc_type_aliases = {
'datetime': 'datetime.datetime',
}

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
Expand All @@ -23,7 +28,7 @@
year = '2024'
author = 'QuestDB'
copyright = '{0}, {1}'.format(year, author)
version = release = '3.0.0rc1'
version = release = '3.0.0'

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

Expand Down
3 changes: 3 additions & 0 deletions docs/conf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ Specifies the version of InfluxDB Line Protocol to use. Valid options are:

TCP/TCPS: Defaults to version 1 for compatibility

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

.. _sender_conf_buffer:

Buffer
Expand Down
Loading