Skip to content
Open
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 = "3.0.0"
current_version = "3.1.0"
commit = false
tag = false

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

=========

3.1.0 (2025-10-06)
------------------

Features
~~~~~~~~

From QuestDB 9.1.0 you can use ``CREATE TABLE`` SQL statements with
``TIMESTAMP_NS`` column types, and/or configure the database to use nanosecond
precision designated timestamp columns by setting the
``line.timestamp.default.column.type=TIMESTAMP_NS`` config option in
``server.conf``.

This client release adds support for sending nanoseconds timestamps to the
server without loss of precision.

The change is backwards compatible with older QuestDB releases and does not
introduce new APIs, but the sender/buffer's ``.row()`` API can now additionally
accept nanosecond precision.

.. code-block:: python

conf = f'http::addr=localhost:9000;'
with Sender.from_conf(conf) as sender:
sender.row(
'trade_executions',
symbols={
'product': 'VOD.L',
'parent_order': '65d1ba36-390e-49a2-93e3-a05ef004b5ff'
'side': 'buy'},
columns={
'order_sent': TimestampNanos(1759246702031355012)},
at=TimestampNanos(1759246702909423071))

If you're using dataframes, nanosecond timestamps are now also transferred with
full precision.

3.0.0 (2025-07-07)
------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and full-connection encryption with
Install
=======

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

::

Expand Down
6 changes: 3 additions & 3 deletions ci/run_tests_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stages:
pool:
name: $(poolName)
vmImage: $(imageName)
timeoutInMinutes: 45
timeoutInMinutes: 90
steps:
- checkout: self
fetchDepth: 1
Expand Down Expand Up @@ -74,7 +74,7 @@ stages:
pool:
name: "Azure Pipelines"
vmImage: "ubuntu-latest"
timeoutInMinutes: 45
timeoutInMinutes: 90
steps:
- checkout: self
fetchDepth: 1
Expand All @@ -98,7 +98,7 @@ stages:
pool:
name: "Azure Pipelines"
vmImage: "ubuntu-latest"
timeoutInMinutes: 45
timeoutInMinutes: 90
steps:
- checkout: self
fetchDepth: 1
Expand Down
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 = '3.0.0'
version = release = '3.1.0'

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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
name = "questdb"
requires-python = ">=3.9"
version = "3.0.0"
version = "3.1.0"
description = "QuestDB client library for Python"
readme = "README.rst"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def readme():

setup(
name='questdb',
version='3.0.0',
version='3.1.0',
platforms=['any'],
python_requires='>=3.8',
install_requires=[],
Expand Down
2 changes: 1 addition & 1 deletion src/questdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.0'
__version__ = '3.1.0'
18 changes: 13 additions & 5 deletions src/questdb/ingress.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ cnp.import_array()
# This value is automatically updated by the `bump2version` tool.
# If you need to update it, also update the search definition in
# .bumpversion.cfg.
VERSION = '3.0.0'
VERSION = '3.1.0'

WARN_HIGH_RECONNECTS = True

Expand Down Expand Up @@ -648,7 +648,7 @@ cdef class SenderTransaction:
symbols: Optional[Dict[str, Optional[str]]]=None,
columns: Optional[Dict[
str,
Union[None, bool, int, float, str, TimestampMicros, datetime.datetime, numpy.ndarray]]
Union[None, bool, int, float, str, TimestampMicros, TimestampNanos, datetime.datetime, numpy.ndarray]]
]=None,
at: Union[ServerTimestampType, TimestampNanos, datetime.datetime]):
"""
Expand Down Expand Up @@ -962,12 +962,18 @@ cdef class Buffer:
if not line_sender_buffer_column_str(self._impl, c_name, c_value, &err):
raise c_err_to_py(err)

cdef inline void_int _column_ts(
cdef inline void_int _column_ts_micros(
self, line_sender_column_name c_name, TimestampMicros ts) except -1:
cdef line_sender_error* err = NULL
if not line_sender_buffer_column_ts_micros(self._impl, c_name, ts._value, &err):
raise c_err_to_py(err)

cdef inline void_int _column_ts_nanos(
self, line_sender_column_name c_name, TimestampNanos ts) except -1:
cdef line_sender_error* err = NULL
if not line_sender_buffer_column_ts_nanos(self._impl, c_name, ts._value, &err):
raise c_err_to_py(err)

cdef inline void_int _column_numpy(
self, line_sender_column_name c_name, cnp.ndarray arr) except -1:
if cnp.PyArray_TYPE(arr) != cnp.NPY_FLOAT64:
Expand Down Expand Up @@ -1020,7 +1026,9 @@ cdef class Buffer:
elif PyUnicode_CheckExact(<PyObject*>value):
self._column_str(c_name, value)
elif isinstance(value, TimestampMicros):
self._column_ts(c_name, value)
self._column_ts_micros(c_name, value)
elif isinstance(value, TimestampNanos):
self._column_ts_nanos(c_name, value)
elif PyArray_CheckExact(<PyObject *> value):
self._column_numpy(c_name, value)
elif isinstance(value, cp_datetime):
Expand Down Expand Up @@ -1115,7 +1123,7 @@ cdef class Buffer:
symbols: Optional[Dict[str, Optional[str]]]=None,
columns: Optional[Dict[
str,
Union[None, bool, int, float, str, TimestampMicros, datetime.datetime, numpy.ndarray]]
Union[None, bool, int, float, str, TimestampMicros, TimestampNanos, datetime.datetime, numpy.ndarray]]
]=None,
at: Union[ServerTimestampType, TimestampNanos, datetime.datetime]):
"""
Expand Down
7 changes: 4 additions & 3 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@ def test_column(self):
'col4': 0.5,
'col5': 'val',
'col6': qi.TimestampMicros(12345),
'col7': two_h_after_epoch,
'col8': None}, at=qi.ServerTimestamp)
'col7': qi.TimestampNanos(12345678),
'col8': two_h_after_epoch,
'col9': None}, at=qi.ServerTimestamp)
exp = (
b'tbl1 col1=t,col2=f,col3=-1i,col4' + _float_binary_bytes(0.5, self.version == 1) +
b',col5="val",col6=12345t,col7=7200000000t\n')
b',col5="val",col6=12345t,col7=12345678n,col8=7200000000t\n')
self.assertEqual(bytes(buf), exp)

def test_none_symbol(self):
Expand Down
40 changes: 20 additions & 20 deletions test/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,12 @@ def test_datetime64_numpy_col(self):
buf = _dataframe(self.version, df, table_name='tbl1', at=qi.ServerTimestamp)
self.assertEqual(
buf,
b'tbl1 a=1546300800000000t,b="a"\n' +
b'tbl1 a=1546300801000000t,b="b"\n' +
b'tbl1 a=1546300802000000t,b="c"\n' +
b'tbl1 a=1546300803000000t,b="d"\n' +
b'tbl1 a=1546300804000000t,b="e"\n' +
b'tbl1 a=1546300805000000t,b="f"\n' +
b'tbl1 a=1546300800000000000n,b="a"\n' +
b'tbl1 a=1546300801000000000n,b="b"\n' +
b'tbl1 a=1546300802000000000n,b="c"\n' +
b'tbl1 a=1546300803000000000n,b="d"\n' +
b'tbl1 a=1546300804000000000n,b="e"\n' +
b'tbl1 a=1546300805000000000n,b="f"\n' +
b'tbl1 b="g"\n' +
b'tbl1 b="h"\n' +
b'tbl1 b="i"\n')
Expand All @@ -856,9 +856,9 @@ def test_datetime64_numpy_col(self):
buf = _dataframe(self.version, df, table_name='tbl1', at=qi.ServerTimestamp)
self.assertEqual(
buf,
b'tbl1 a=0t\n' +
b'tbl1 a=1000000t\n' +
b'tbl1 a=2000000t\n')
b'tbl1 a=0n\n' +
b'tbl1 a=1000000000n\n' +
b'tbl1 a=2000000000n\n')

def test_datetime64_tz_arrow_col(self):
df = pd.DataFrame({
Expand All @@ -878,10 +878,10 @@ def test_datetime64_tz_arrow_col(self):
self.assertEqual(
buf,
# Note how these are 5hr offset from `test_datetime64_numpy_col`.
b'tbl1,b=sym1 a=1546318800000000t\n' +
b'tbl1,b=sym2 a=1546318801000000t\n' +
b'tbl1,b=sym1 a=1546318800000000000n\n' +
b'tbl1,b=sym2 a=1546318801000000000n\n' +
b'tbl1,b=sym3\n' +
b'tbl1,b=sym4 a=1546318803000000t\n')
b'tbl1,b=sym4 a=1546318803000000000n\n')

# Not epoch 0.
df = pd.DataFrame({
Expand All @@ -900,9 +900,9 @@ def test_datetime64_tz_arrow_col(self):
self.assertEqual(
buf,
# Note how these are 5hr offset from `test_datetime64_numpy_col`.
b'tbl1,b=sym1 a=18000000000t\n' +
b'tbl1,b=sym2 a=18001000000t\n' +
b'tbl1,b=sym3 a=18002000000t\n')
b'tbl1,b=sym1 a=18000000000000n\n' +
b'tbl1,b=sym2 a=18001000000000n\n' +
b'tbl1,b=sym3 a=18002000000000n\n')

# Actual epoch 0.
df = pd.DataFrame({
Expand All @@ -920,9 +920,9 @@ def test_datetime64_tz_arrow_col(self):
buf = _dataframe(self.version, df, table_name='tbl1', symbols=['b'], at=qi.ServerTimestamp)
self.assertEqual(
buf,
b'tbl1,b=sym1 a=0t\n' +
b'tbl1,b=sym2 a=1000000t\n' +
b'tbl1,b=sym3 a=2000000t\n')
b'tbl1,b=sym1 a=0n\n' +
b'tbl1,b=sym2 a=1000000000n\n' +
b'tbl1,b=sym3 a=2000000000n\n')

df2 = pd.DataFrame({
'a': [
Expand All @@ -936,8 +936,8 @@ def test_datetime64_tz_arrow_col(self):
# Mostly, here assert that negative timestamps are allowed.
self.assertIn(
buf,
[b'tbl1,b=sym1 a=-2208970800000000t\n',
b'tbl1,b=sym1 a=-2208971040000000t\n'])
[b'tbl1,b=sym1 a=-2208970800000000000n\n',
b'tbl1,b=sym1 a=-2208971040000000000n\n'])

def test_datetime64_numpy_at(self):
df = pd.DataFrame({
Expand Down