Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
78ff32f
BREAKING CHANGE: buffer expose as bytes instead of str
kafka1991 Mar 25, 2025
250135d
comment optimize.
kafka1991 Mar 25, 2025
874b90b
rename peek() to __bytes__
kafka1991 Mar 25, 2025
9118a09
resolve conflict.
kafka1991 Apr 6, 2025
75f620d
python client begin.
kafka1991 May 8, 2025
6ecc6da
python f64 array interface.
kafka1991 May 9, 2025
a4c02f1
add python tests
kafka1991 May 9, 2025
48b7517
fix http port
kafka1991 May 9, 2025
cc806dd
fix some python tests.
kafka1991 May 9, 2025
b94ee75
add line protocol version tests, array tests, and dataframe support n…
kafka1991 May 12, 2025
53f929d
update dep.
kafka1991 May 12, 2025
0106e0f
dataframe support ndarray.
kafka1991 May 12, 2025
dc613d5
data frame support ndarray.
kafka1991 May 12, 2025
1f39b9b
Merge remote-tracking branch 'origin/main' into array
kafka1991 May 12, 2025
ccec47f
fix tests and typo.
kafka1991 May 13, 2025
6dd2922
optimize python client.
kafka1991 May 16, 2025
55e965a
enrich python tests
kafka1991 May 19, 2025
36f0fe5
enrich python tests
kafka1991 May 19, 2025
704f47d
remove large array tests
kafka1991 May 19, 2025
5e7231f
fix tests
kafka1991 May 19, 2025
0050c4d
fix fuzz tests
kafka1991 May 19, 2025
060419a
add sleep time in tests.
kafka1991 May 19, 2025
8d8f5fc
change host to 127.0.0.1 from localhost
kafka1991 May 19, 2025
593bda3
fix tests
kafka1991 May 19, 2025
c17b989
fix py client
kafka1991 May 21, 2025
44f793e
update tests
kafka1991 May 21, 2025
84edbdd
updated c-questdb-client submodule
amunra May 21, 2025
a3cc1d2
bump version and update pyproject.toml
kafka1991 May 21, 2025
435bd55
Merge remote-tracking branch 'origin/array' into array
kafka1991 May 21, 2025
ac661bd
simplifying protocol_version API
amunra May 21, 2025
e7e04e4
negative testing of protocol version
amunra May 22, 2025
976151f
fixed timeout test flakiness
amunra May 22, 2025
c453a86
add docs and fix Gil issue.
kafka1991 May 23, 2025
1e24547
avoiding incref/decref when accessing numpy arrays within a dataframe
amunra May 23, 2025
1456cc2
Merge branch 'array' of https://github.com/questdb/py-questdb-client …
amunra May 23, 2025
cf4e9c9
minor commenting and renaming
amunra May 23, 2025
3c833b1
update insert array api.
kafka1991 May 23, 2025
0afb16e
tweaks
amunra May 23, 2025
b384ae0
Merge branch 'array' of https://github.com/questdb/py-questdb-client …
amunra May 23, 2025
1725951
cleanup
amunra May 25, 2025
53bd5f1
Fixed up front page docs with install instructions
amunra May 25, 2025
fc60c24
Fixed API docs (mostly, not completely)
amunra May 25, 2025
7973fe0
more doc fixes
amunra May 25, 2025
0dc0578
test fix
amunra May 25, 2025
be86c62
updated c-questdb-client submodule
amunra May 25, 2025
0c02ee7
adapt `/settings` response format.
kafka1991 May 26, 2025
088048b
Updated changelog
amunra May 26, 2025
2218b8a
updated notes and scripts to remove py3.8
amunra May 26, 2025
3489be8
fixed cibuildwheel
amunra May 26, 2025
29cad6e
attempting to fix cibuildwheel.yaml
amunra May 26, 2025
9250d66
first update pandas when install dependency.
kafka1991 May 26, 2025
2fe9081
force install pandas new version.
kafka1991 May 26, 2025
7dcde43
print port
kafka1991 May 26, 2025
f06cfab
add server timeout.
kafka1991 May 26, 2025
b84a6e4
removed linux 32-bit builds from CI
amunra May 26, 2025
f09d37a
simplify handle of doGet.
kafka1991 May 27, 2025
0e166d4
use more concise timer
kafka1991 May 27, 2025
8bc17a7
force keep connection.
kafka1991 May 27, 2025
bbb795c
update c-submodule.
kafka1991 May 27, 2025
3f181cd
try to increase test auto flush intervel.
kafka1991 May 27, 2025
9646726
try to use windows latest in CI
kafka1991 May 27, 2025
2d828c0
use msvc for windows platform in CI.
kafka1991 May 28, 2025
62d15bf
revert remove of PublishBuildArtifacts@1
kafka1991 May 28, 2025
be69866
fix flake tests.
kafka1991 May 28, 2025
8664617
fix flake tests.
kafka1991 May 28, 2025
26422b4
adjust `test_http_request_min_throughput_timeout` tests.
kafka1991 May 28, 2025
6d73b05
Reverting back to naming ILP as InfluxDB line protocol, but clarifyin…
amunra Jun 2, 2025
4e9a424
updated submodule
amunra Jun 2, 2025
16312ae
updated changelog date
amunra Jun 2, 2025
89ee45e
Fixed versioning in missing files
amunra Jun 2, 2025
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.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.4
current_version = 3.0.0rc1
commit = True
tag = False

Expand Down
66 changes: 66 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,74 @@
.. _changelog:


Changelog

=========

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

This is the pre-release of a major release introducing array ingestion and some
minor breaking changes.

Features
~~~~~~~~
* Array Data Type Support. Adds native support for NumPy arrays
(currently only for ``np.float64`` element type and up to 32 dimensions).

.. 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)

* Implements binary protocol for columns of ``float`` (double-precision) and
``numpy.ndarray[np.float64]``, with performance improvements for these
two datatypes.

Breaking Changes
~~~~~~~~~~~~~~~~
* Buffer Constructor Changes. The ``Buffer`` constructor now requires the ``protocol_version`` parameter.
You can create buffer through the sender for automatic ``protocol_version`` management:

.. code-block:: python

buf = sender.new_buffer() # protocol_version determined automatically
buf.row(
'table',
columns={'arr': np.array([1.5, 3.0], dtype=np.float64)},
at=timestamp)

* To access the raw payload, call ``bytes(sender)`` or ``bytes(buffer)`` (
rather than calling the ``str`` function on the same objects as in version
2.x.x of the questdb library) method.

* **NumPy Dependency**

Array functionality mandates NumPy installation.

* **Sender/Buffer String Conversion Removal**

The legacy string conversion via `str(sender)` is removed.
Access raw binary payloads through the `bytes(sender)` method:

.. code-block:: python

# for debugging
payload = bytes(sender)

* Python 3.8 support is dropped.

The minimum supported Python version is now 3.9.

2.0.4 (2025-04-02)
------------------

Expand Down
38 changes: 32 additions & 6 deletions 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
`InfluxDB Line Protocol <https://questdb.io/docs/reference/api/ilp/overview/>`_
`Ingestion 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 All @@ -15,16 +15,29 @@ This implementation supports `authentication
and full-connection encryption with
`TLS <https://py-questdb-client.readthedocs.io/en/latest/conf.html#tls>`_.

Quickstart
==========
Install
=======

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

::

python3 -m pip install -U questdb[dataframe]

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

The latest *pre-release* version of the library is **3.0.0r1** (`changelog <https://py-questdb-client.readthedocs.io/en/latest/changelog.html>`_).
This release supports NumPy float64 arrays which are transmitted over a new
protocol version supported by QuestDB 8.4.0 or later.

::

python3 -m pip install --pre -U questdb[dataframe]

Quickstart
==========

Start by `setting up QuestDB <https://questdb.io/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 All @@ -38,6 +51,13 @@ The most common way to insert data is from a Pandas dataframe.
'side': pd.Categorical(['sell', 'sell']),
'price': [2615.54, 39269.98],
'amount': [0.00044, 0.001],

# NumPy float64 arrays are supported from v3.0.0rc1 onwards.
'ord_book_bids': [
np.array([2615.54, 2618.63]),
np.array([39269.98, 39270.00])
],

'timestamp': pd.to_datetime(['2021-01-01', '2021-01-02'])})

conf = f'http::addr=localhost:9000;'
Expand All @@ -57,7 +77,13 @@ You can also send individual rows. This only requires a more minimal installatio
sender.row(
'trades',
symbols={'symbol': 'ETH-USD', 'side': 'sell'},
columns={'price': 2615.54, 'amount': 0.00044},
columns={
'price': 2615.54,
'amount': 0.00044,

# NumPy float64 arrays are supported from v3.0.0rc1 onwards.
'ord_book_bids': np.array([2615.54, 2618.63]),
},
at=TimestampNanos.now())
sender.flush()

Expand Down
7 changes: 3 additions & 4 deletions RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ Inside the VM, open a terminal (or use the terminal Window in VSCode) and run th

rustup update stable

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 \
-m pip install -U pip
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 \
-m pip install -U setuptools wheel twine Cython cibuildwheel pandas numpy pyarrow
python3 -m pip install -U pip
python3 -m pip install -U \
setuptools wheel twine Cython cibuildwheel pandas numpy pyarrow

Smoke-testing the build
-----------------------
Expand Down
2 changes: 1 addition & 1 deletion c-questdb-client
Submodule c-questdb-client updated 110 files
50 changes: 30 additions & 20 deletions ci/cibuildwheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ stages:
- job: linux_arm64
pool:
name: "arm64-clients"
vmImage:
demands:
- Agent.Name -equals arm64-clients-$(Build.BuildId)
dependsOn:
Expand Down Expand Up @@ -92,23 +91,6 @@ stages:
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}

- job: linux_x64_cpython_manylinux_i686
pool: {vmImage: 'ubuntu-latest'}
timeoutInMinutes: 90
steps:
- task: UsePythonVersion@0
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
env:
CIBW_BUILD: cp*-manylinux_i686
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}

- job: linux_x64_cpython_musllinux
pool: {vmImage: 'ubuntu-latest'}
timeoutInMinutes: 90
Expand Down Expand Up @@ -168,9 +150,22 @@ stages:
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
- powershell: |
$vsPath = Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\*\VC\Auxiliary\Build\vcvars32.bat"
cmd /c "call `"$vsPath`" && set > env_vars.txt"

Get-Content env_vars.txt | ForEach-Object {
if ($_ -match "^([^=]+?)=(.*)$" -and $matches[1] -notmatch '^(SYSTEM|AGENT|BUILD|RELEASE|VSTS|TASK|USE_|FAIL_|MSDEPLOY|AZP_75787|AZP_AGENT|AZP_ENABLE|AZURE_HTTP|COPYFILESOVERSSHV0|ENABLE_ISSUE_SOURCE_VALIDATION|MODIFY_NUMBER_OF_RETRIES_IN_ROBOCOPY|MSBUILDHELPERS_ENABLE_TELEMETRY|RETIRE_AZURERM_POWERSHELL_MODULE|ROSETTA2_WARNING|AZP_PS_ENABLE)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
Write-Host "##vso[task.setvariable variable=$($matches[1])]$($matches[2])"
}
}

where.exe cl.exe
cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
env:
CIBW_ENVIRONMENT: "MSSdk=1 DISTUTILS_USE_SDK=1 SETUP_DO_GIT_SUBMODULE_INIT=1"
CIBW_BUILD: "*win32*"
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}
Expand All @@ -185,9 +180,24 @@ stages:
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
- powershell: |
$vsPath = Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\*\VC\Auxiliary\Build\vcvars64.bat"
cmd /c "call `"$vsPath`" && set > env_vars.txt"

Get-Content env_vars.txt | ForEach-Object {
if ($_ -match "^([^=]+?)=(.*)$" -and $matches[1] -notmatch '^(SYSTEM|AGENT|BUILD|RELEASE|VSTS|TASK|USE_|FAIL_|MSDEPLOY|AZP_75787|AZP_AGENT|AZP_ENABLE|AZURE_HTTP|COPYFILESOVERSSHV0|ENABLE_ISSUE_SOURCE_VALIDATION|MODIFY_NUMBER_OF_RETRIES_IN_ROBOCOPY|MSBUILDHELPERS_ENABLE_TELEMETRY|RETIRE_AZURERM_POWERSHELL_MODULE|ROSETTA2_WARNING|AZP_PS_ENABLE)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
Write-Host "##vso[task.setvariable variable=$($matches[1])]$($matches[2])"
}
}

where.exe cl.exe
cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
env:
CIBW_BUILD: "*win_amd64*"
CIBW_ENVIRONMENT: "MSSdk=1 DISTUTILS_USE_SDK=1 SETUP_DO_GIT_SUBMODULE_INIT=1"
CIBW_BUILD_VERBOSITY: "3"
DISTUTILS_DEBUG: "1"
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}
7 changes: 3 additions & 4 deletions ci/pip_install_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,19 @@ def install_old_pandas_and_numpy(args):
try_pip_install('numpy<2')

def install_new_pandas_and_numpy():
try_pip_install('pandas')
try_pip_install('numpy')
try_pip_install('pandas>2')
try_pip_install('numpy>2')

def main(args):
ensure_timezone()
pip_install('pip')
pip_install('setuptools')
try_pip_install('fastparquet>=2023.10.1')

if args.pandas_version is not None and args.pandas_version != '':
install_old_pandas_and_numpy(args)
else:
install_new_pandas_and_numpy()

try_pip_install('fastparquet>=2023.10.1')
try_pip_install('pyarrow')

on_linux_is_glibc = (
Expand Down
56 changes: 55 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,61 @@ questdb.ingress

from questdb.ingress import *

.. automodule:: questdb.ingress
.. autoclass:: questdb.ingress.Sender
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.Buffer
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.SenderTransaction
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.IngressError
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.IngressErrorCode
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.Protocol
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.TimestampMicros
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.TimestampNanos
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.TlsCa
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: questdb.ingress.ServerTimestampType
:members:
:undoc-members:
:show-inheritance:

.. autodata:: questdb.ingress.ServerTimestamp
:annotation:
:no-value:

.. autoclass:: questdb.ingress.TaggedEnum
:members:
:undoc-members:
:show-inheritance:
12 changes: 10 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import os

from questdb.ingress import *

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
Expand All @@ -12,15 +14,16 @@
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode'
'sphinx.ext.viewcode',
"sphinx.ext.intersphinx",
]
source_suffix = '.rst'
master_doc = 'index'
project = 'questdb'
year = '2024'
author = 'QuestDB'
copyright = '{0}, {1}'.format(year, author)
version = release = '2.0.4'
version = release = '3.0.0rc1'

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

Expand Down Expand Up @@ -67,6 +70,11 @@
'undoc-members': True
}

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
}

# def do_not_skip_dunder_members(_app, _what, name, _obj, would_skip, _options):
# if name in ('__init__', '__call__', '__str__', '__enter__', '__exit__'):
Expand Down
Loading