Skip to content

Commit 8e4b407

Browse files
authored
Bump version: 1.2.0 → 2.0.0 (#65)
1 parent d26da90 commit 8e4b407

13 files changed

+297
-53
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.0
2+
current_version = 2.0.0
33
commit = True
44
tag = False
55

CHANGELOG.rst

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,171 @@
22
Changelog
33
=========
44

5+
2.0.0 (2024-03-19)
6+
------------------
7+
8+
This is a major release with new features and breaking changes.
9+
10+
Features
11+
~~~~~~~~
12+
13+
* Support for ILP over HTTP. The sender can now send data to QuestDB via HTTP
14+
instead of TCP. This provides error feedback from the server and new features.
15+
16+
.. code-block:: python
17+
18+
conf = 'http::addr=localhost:9000;'
19+
with Sender.from_conf(conf) as sender:
20+
sender.row(...)
21+
sender.dataframe(...)
22+
23+
# Will raise `IngressError` if there is an error from the server.
24+
sender.flush()
25+
26+
* New configuration string construction. The sender can now be also constructed
27+
from a :ref:`configuration string <sender_conf>` in addition to the
28+
constructor arguments.
29+
This allows for more flexible configuration and is the recommended way to
30+
construct a sender.
31+
The same string can also be loaded from the ``QDB_CLIENT_CONF`` environment
32+
variable.
33+
The constructor arguments have been updated and some options have changed.
34+
35+
* Explicit transaction support over HTTP. A set of rows for a single table can
36+
now be committed via the sender transactionally. You can do this using a
37+
``with sender.transaction('table_name') as txn:`` block.
38+
39+
.. code-block:: python
40+
41+
conf = 'http::addr=localhost:9000;'
42+
with Sender.from_conf(conf) as sender:
43+
with sender.transaction('test_table') as txn:
44+
# Same arguments as the sender methods, minus the table name.
45+
txn.row(...)
46+
txn.dataframe(...)
47+
48+
* A number of documentation improvements.
49+
50+
51+
Breaking Changes
52+
~~~~~~~~~~~~~~~~
53+
54+
* New ``protocol`` parameter in the
55+
:ref:`Sender <sender_programmatic_construction>` constructor.
56+
57+
In previous version the protocol was always TCP.
58+
In this new version you must specify the protocol explicitly.
59+
60+
* New auto-flush defaults. In previous versions
61+
:ref:`auto-flushing <sender_auto_flush>` was enabled by
62+
default and triggered by a maximum buffer size. In this new version
63+
auto-flushing is enabled by row count (600 rows by default) and interval
64+
(1 second by default), while auto-flushing by buffer size is disabled by
65+
default.
66+
67+
The old behaviour can be still be achieved by tweaking the auto-flush
68+
settings.
69+
70+
.. list-table::
71+
:header-rows: 1
72+
73+
* - Setting
74+
- Old default
75+
- New default
76+
* - **auto_flush_rows**
77+
- off
78+
- 600
79+
* - **auto_flush_interval**
80+
- off
81+
- 1000
82+
* - **auto_flush_bytes**
83+
- 64512
84+
- off
85+
86+
* The ``at=..`` argument of :func:`row <questdb.ingress.Sender.row>` and
87+
:func:`dataframe <questdb.ingress.Sender.dataframe>` methods is now mandatory.
88+
Omitting it would previously use a server-generated timestamp for the row.
89+
Now if you want a server generated timestamp, you can pass the :ref:`ServerTimestamp <sender_server_timestamp>`
90+
singleton to this parameter. _The ``ServerTimestamp`` behaviour is considered legacy._
91+
92+
* The ``auth=(u, t, x, y)`` argument of the ``Sender`` constructor has now been
93+
broken up into multiple arguments: ``username``, ``token``, ``token_x``, ``token_y``.
94+
95+
* The ``tls`` argument of the ``Sender`` constructor has been removed and
96+
replaced with the ``protocol`` argument. Use ``Protocol.Tcps``
97+
(or ``Protocol.Https``) to enable TLS.
98+
The ``tls`` values have been moved to new ``tls_ca`` and ``tls_roots``
99+
:ref:`configuration settings <sender_conf_tls>`.
100+
101+
* The ``net_interface`` argument of the ``Sender`` constructor has been renamed
102+
to ``bind_interface`` and is now only available for TCP connections.
103+
104+
The following example shows how to migrate to the new API.
105+
106+
**Old questdb 1.x code**
107+
108+
.. code-block:: python
109+
110+
from questdb.ingress import Sender
111+
112+
auth = (
113+
'testUser1',
114+
'5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48',
115+
'token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU',
116+
'token_y=Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac')
117+
with Sender('localhost', 9009, auth=auth, tls=True) as sender:
118+
sender.row(
119+
'test_table',
120+
symbols={'sym': 'AAPL'},
121+
columns={'price': 100.0}) # `at=None` was defaulted for server time
122+
123+
**Equivalent questdb 2.x code**
124+
125+
.. code-block:: python
126+
127+
from questdb.ingress import Sender, Protocol, ServerTimestamp
128+
129+
sender = Sender(
130+
Protocol.Tcps,
131+
'localhost',
132+
9009,
133+
username='testUser1',
134+
token='5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48',
135+
token_x='token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU',
136+
token_y='token_y=Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac',
137+
auto_flush_rows='off',
138+
auto_flush_interval='off',
139+
auto_flush_bytes=64512)
140+
with sender:
141+
sender.row(
142+
'test_table',
143+
symbols={'sym': 'AAPL'},
144+
columns={'price': 100.0},
145+
at=ServerTimestamp)
146+
147+
**Equivalent questdb 2.x code with configuration string**
148+
149+
.. code-block:: python
150+
151+
from questdb.ingress import Sender
152+
153+
conf = (
154+
'tcp::addr=localhost:9009;' +
155+
'username=testUser1;' +
156+
'token=5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48;' +
157+
'token_x=token_x=fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU;' +
158+
'token_y=token_y=Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac;' +
159+
'auto_flush_rows=off;' +
160+
'auto_flush_interval=off;' +
161+
'auto_flush_bytes=64512')
162+
with Sender.from_conf(conf) as sender:
163+
sender.row(
164+
'test_table',
165+
symbols={'sym': 'AAPL'},
166+
columns={'price': 100.0},
167+
at=ServerTimestamp)
168+
169+
5170
1.2.0 (2023-11-23)
6171
------------------
7172

README.rst

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22
QuestDB Client Library for Python
33
=================================
44

5-
This library makes it easy to insert data into `QuestDB <https://questdb.io>`_.
5+
This is the official Python client library for `QuestDB <https://questdb.io>`_.
66

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

1111
ILP provides the fastest way to insert data into QuestDB.
1212

1313
This implementation supports `authentication
14-
<https://questdb.io/docs/reference/api/ilp/authenticate/>`_ and full-connection
15-
encryption with TLS.
14+
<https://py-questdb-client.readthedocs.io/en/latest/conf.html#authentication>`_
15+
and full-connection encryption with
16+
`TLS <https://py-questdb-client.readthedocs.io/en/latest/conf.html#tls>`_.
1617

1718
Quickstart
1819
==========
1920

20-
The latest version of the library is 1.2.0.
21+
The latest version of the library is 2.0.0.
2122

2223
::
2324

2425
python3 -m pip install -U questdb
2526

27+
Please start by `setting up QuestDB <https://questdb.io/docs/quick-start/>`_ . Once set up, you can use this library to insert data.
28+
2629
.. code-block:: python
2730
2831
from questdb.ingress import Sender, TimestampNanos
@@ -68,29 +71,25 @@ You can continue by reading the
6871
`Sending Data Over ILP <https://py-questdb-client.readthedocs.io/en/latest/sender.html>`_
6972
guide.
7073

71-
Docs
72-
====
73-
74-
https://py-questdb-client.readthedocs.io/
75-
74+
Links
75+
=====
7676

77-
Code
78-
====
77+
* `Core database documentation <https://questdb.io/docs/>`_
7978

80-
https://github.com/questdb/py-questdb-client
79+
* `Python library documentation <https://py-questdb-client.readthedocs.io/>`_
8180

81+
* `GitHub repository <https://github.com/questdb/py-questdb-client>`_
8282

83-
Package on PyPI
84-
===============
85-
86-
https://pypi.org/project/questdb/
87-
83+
* `Package on PyPI <https://pypi.org/project/questdb/>`_
8884

8985
Community
9086
=========
9187

92-
If you need help, have additional questions or want to provide feedback, you
93-
may find us on `Slack <https://slack.questdb.io>`_.
88+
If you need help, you can ask on `Stack Overflow
89+
<https://stackoverflow.com/questions/ask?tags=questdb&tags=py-questdb-client>`_:
90+
We monitor the ``#questdb`` and ``#py-questdb-client`` tags.
91+
92+
Alternatively, you may find us on `Slack <https://slack.questdb.io>`_.
9493

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

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
source_suffix = '.rst'
1818
master_doc = 'index'
1919
project = 'questdb'
20-
year = '2023'
20+
year = '2024'
2121
author = 'QuestDB'
2222
copyright = '{0}, {1}'.format(year, author)
23-
version = release = '1.2.0'
23+
version = release = '2.0.0'
2424

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

docs/conf.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ If you're unsure which protocol to use, see :ref:`sender_which_protocol`.
3636
Only the ``addr=host:port`` key is mandatory. It specifies the hostname and port
3737
of the QuestDB server.
3838

39+
The same configuration string can also be loaded from the ``QDB_CLIENT_CONF``
40+
environment variable. This is useful for keeping sensitive information out of
41+
your code.
42+
43+
.. code-block:: bash
44+
45+
export QDB_CLIENT_CONF="http::addr=localhost:9009;username=admin;password=quest;"
46+
47+
.. code-block:: python
48+
49+
from questdb.ingress import Sender
50+
51+
with Sender.from_env() as sender:
52+
...
53+
3954
Connection
4055
==========
4156

docs/examples.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ Examples
55
Basics
66
======
77

8-
Row-by-row Insertion
8+
HTTP with Token Auth
99
--------------------
1010

1111
The following example connects to the database and sends two rows (lines).
1212

13-
The connection is unauthenticated and the data is sent at the end of the
14-
``with`` block.
13+
The connection is made via HTTPS and uses token based authentication.
1514

16-
.. literalinclude:: ../examples/basic.py
15+
The data is sent at the end of the ``with`` block.
16+
17+
.. literalinclude:: ../examples/http.py
1718
:language: python
1819

1920

2021
.. _auth_and_tls_example:
2122

22-
Authentication and TLS
23-
----------------------
23+
TCP Authentication and TLS
24+
--------------------------
2425

2526
Continuing from the previous example, the connection is authenticated
2627
and also uses TLS.
@@ -44,13 +45,13 @@ Note that this bypasses :ref:`auto-flushing <sender_auto_flush>`.
4445
:language: python
4546

4647

47-
Ticking Random Data and Timer-based Flush
48-
-----------------------------------------
48+
Ticking Data and Auto-Flush
49+
---------------------------
4950

5051
The following example somewhat mimics the behavior of a loop in an application.
5152

52-
It creates random ticking data at a random interval and flushes it explicitly
53-
based on a timer if the auto-flushing logic was not triggered recently.
53+
It creates random ticking data at a random interval and uses non-default
54+
auto-flush settings.
5455

5556
.. literalinclude:: ../examples/random_data.py
5657
:language: python

docs/sender.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ Note that all timestamps in QuestDB are stored as microseconds since the epoch,
168168
without timezone information. Any timezone information is dropped when the data
169169
is appended to the ILP buffer.
170170

171+
.. _sender_server_timestamp:
172+
171173
Set by server
172174
~~~~~~~~~~~~~
173175

@@ -591,15 +593,15 @@ Python type mappings:
591593

592594
* Parameters that require numbers can also take an ``int``.
593595

594-
* Millisecond durations can take an ``int`` or a ```datetime.timedelta``.
596+
* Millisecond durations can take an ``int`` or a ``datetime.timedelta``.
595597

596598
* Any ``'on'`` / ``'off'`` / ``'unsafe_off'`` parameters can also be specified
597599
as a ``bool``.
598600

599601
* Paths can also be specified as a ``pathlib.Path``.
600602

601-
Customising `.from_conf()` and `.from_env()`
602-
--------------------------------------------
603+
Customising ``.from_conf()`` and ``.from_env()``
604+
------------------------------------------------
603605

604606
If you want to further customise the behaviour of the ``.from_conf()`` or
605607
``.from_env()`` methods, you can pass additional parameters to these methods.

0 commit comments

Comments
 (0)