Skip to content

Commit cf00547

Browse files
amunraamyshwang
andauthored
Bump version: 1.0.0 → 1.0.1 (#16)
* docs: Updated changelog. * chore: Updated changelog. * docs: Improved documentation for flushing errors. * chore: Disabled tagging from bumpversion. * Bump version: 1.0.0 → 1.0.1 * Update CHANGELOG.rst Co-authored-by: Amy Wang <107401731+amyshwang@users.noreply.github.com> * Update CHANGELOG.rst Co-authored-by: Amy Wang <107401731+amyshwang@users.noreply.github.com> Co-authored-by: Amy Wang <107401731+amyshwang@users.noreply.github.com>
1 parent d6958b5 commit cf00547

File tree

10 files changed

+105
-25
lines changed

10 files changed

+105
-25
lines changed

.bumpversion.cfg

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
2-
current_version = 1.0.0
2+
current_version = 1.0.1
33
commit = True
4-
tag = True
4+
tag = False
55

66
[bumpversion:file:pyproject.toml]
77
search = version = "{current_version}"
@@ -22,3 +22,7 @@ replace = version = release = '{new_version}'
2222
[bumpversion:file:src/questdb/__init__.py]
2323
search = __version__ = '{current_version}'
2424
replace = __version__ = '{new_version}'
25+
26+
[bumpversion:file:src/questdb/ingress.pyx]
27+
search = 'v{current_version}'
28+
replace = 'v{new_version}'

CHANGELOG.rst

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
Changelog
33
=========
44

5+
1.0.1 (2022-08-16)
6+
------------------
7+
8+
* Fixed a major bug where Python ``int`` and ``float`` types were handled with
9+
32-bit instead of 64-bit precision. This caused certain ``int`` values to be
10+
rejected and other ``float`` values to be rounded incorrectly.
11+
Closes `#13 <https://github.com/questdb/py-questdb-client/issues/13>`_.
12+
* As a matter of convenience, the ``Buffer.row`` method can now take ``None`` column
13+
values. This has the same semantics as skipping the column altogether.
14+
Closes `#3 <https://github.com/questdb/py-questdb-client/issues/3>`_.
15+
* Fixed a minor bug where an error auto-flush caused a second clean-up error.
16+
Closes `#4 <https://github.com/questdb/py-questdb-client/issues/4>`_.
17+
18+
519
1.0.0 (2022-07-15)
620
------------------
721

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ encryption with TLS.
1717
Quickstart
1818
==========
1919

20-
The latest version of the library is 1.0.0.
20+
The latest version of the library is 1.0.1.
2121

2222
::
2323

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
year = '2022'
2121
author = 'QuestDB'
2222
copyright = '{0}, {1}'.format(year, author)
23-
version = release = '1.0.0'
23+
version = release = '1.0.1'
2424

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

docs/troubleshooting.rst

+56-8
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,68 @@ The :class:`questdb.ingress.Sender` class only provides auto-flushing based on
3939
a buffer size and *not on a timer*.
4040

4141

42-
Inspecting and debugging errors
43-
===============================
42+
Errors during flushing
43+
----------------------
4444

45-
Both the :class:`questdb.ingress.Sender` and :class:`questdb.ingress.Buffer`
46-
types support ``__len__`` and ``__str__`` methods to inspect the buffer that is
47-
about to be flushed.
45+
Server disconnects
46+
~~~~~~~~~~~~~~~~~~
4847

49-
Note that the ILP protocol does not send errors back to the client.
48+
A failure in :func:`questdb.ingress.Sender.flush` generally indicates that the
49+
network connection was dropped.
5050

51-
On error, the QuestDB server will disconnect and any error messages will be
52-
present in the `server logs
51+
The ILP protocol does not send errors back to the client. Instead, by design,
52+
it will disconnect a client if it encounters any insertion errors. This is to
53+
avoid errors going unnoticed.
54+
55+
As an example, if a client were to insert a ``STRING`` value into a ``BOOLEAN``
56+
column, the QuestDB server would disconnect the client.
57+
58+
To determine the root cause of a disconnect, inspect the `server logs
5359
<https://questdb.io/docs/concept/root-directory-structure#log-directory>`_.
5460

5561

62+
Logging outgoing messages
63+
~~~~~~~~~~~~~~~~~~~~~~~~~
64+
65+
To understand what data was sent to the server, you may log outgoing messages
66+
from Python.
67+
68+
Here's an example if you append rows to the ``Sender`` object:
69+
70+
.. code-block:: python
71+
72+
import textwrap
73+
74+
with Sender(...) as sender:
75+
# sender.row(...)
76+
# sender.row(...)
77+
# ...
78+
pending = str(sender)
79+
logging.info('About to flush:\n%s', textwrap.indent(pending, ' '))
80+
sender.flush()
81+
82+
Alternatively, if you're constructing buffers explicitly:
83+
84+
.. code-block:: python
85+
86+
import textwrap
87+
88+
buffer = sender.new_buffer()
89+
# buffer.row(...)
90+
# buffer.row(...)
91+
# ...
92+
pending = str(buffer)
93+
logging.info('About to flush:\n%s', textwrap.indent(pending, ' '))
94+
sender.flush(buffer)
95+
96+
97+
Note that to handle out-of-order messages efficiently, the QuestDB server will
98+
delay appling changes it receives over ILP after a configurable
99+
`commit lag <https://questdb.io/docs/guides/out-of-order-commit-lag>`_.
100+
101+
Due to this commit lag, the line that caused the error may not be the last line.
102+
103+
56104
Asking for help
57105
===============
58106

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See: https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
33
name = "questdb"
44
requires-python = ">=3.7"
5-
version = "1.0.0"
5+
version = "1.0.1"
66
description = "QuestDB client library for Python"
77
readme = "README.rst"
88
classifiers = [

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def readme():
120120

121121
setup(
122122
name='questdb',
123-
version='1.0.0',
123+
version='1.0.1',
124124
platforms=['any'],
125125
python_requires='>=3.7',
126126
install_requires=[],

src/questdb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.0.1'

src/questdb/ingress.pyx

+23-9
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ cdef inline object c_err_code_to_py(line_sender_error_code code):
132132
raise ValueError('Internal error converting error code.')
133133

134134

135-
cdef inline object c_err_to_py(line_sender_error* err):
136-
"""Construct a ``SenderError`` from a C error, which will also be freed."""
135+
cdef inline object c_err_to_code_and_msg(line_sender_error* err):
136+
"""Construct a ``SenderError`` from a C error, which will be freed."""
137137
cdef line_sender_error_code code = line_sender_error_get_code(err)
138138
cdef size_t c_len = 0
139139
cdef const char* c_msg = line_sender_error_msg(err, &c_len)
@@ -142,15 +142,24 @@ cdef inline object c_err_to_py(line_sender_error* err):
142142
cdef object py_code
143143
try:
144144
py_code = c_err_code_to_py(code)
145-
py_msg = PyUnicode_FromKindAndData(
146-
PyUnicode_1BYTE_KIND,
147-
c_msg,
148-
<Py_ssize_t>c_len)
149-
return IngressError(py_code, py_msg)
145+
py_msg = PyUnicode_FromStringAndSize(c_msg, <Py_ssize_t>c_len)
146+
return (py_code, py_msg)
150147
finally:
151148
line_sender_error_free(err)
152149

153150

151+
cdef inline object c_err_to_py(line_sender_error* err):
152+
"""Construct an ``IngressError`` from a C error, which will be freed."""
153+
cdef object tup = c_err_to_code_and_msg(err)
154+
return IngressError(tup[0], tup[1])
155+
156+
157+
cdef inline object c_err_to_py_fmt(line_sender_error* err, str fmt):
158+
"""Construct an ``IngressError`` from a C error, which will be freed."""
159+
cdef object tup = c_err_to_code_and_msg(err)
160+
return IngressError(tup[0], fmt.format(tup[1]))
161+
162+
154163
cdef bytes str_to_utf8(str string, line_sender_utf8* utf8_out):
155164
"""
156165
Init the `utf8_out` object from the `string`.
@@ -932,6 +941,11 @@ cdef class Buffer:
932941
# raise ValueError('nyi')
933942

934943

944+
_FLUSH_FMT = ('{} - See https://py-questdb-client.readthedocs.io/en/'
945+
'v1.0.1'
946+
'/troubleshooting.html#inspecting-and-debugging-errors#flush-failed')
947+
948+
935949
cdef class Sender:
936950
"""
937951
A sender is a client that inserts rows into QuestDB via the ILP protocol.
@@ -1313,10 +1327,10 @@ cdef class Sender:
13131327
try:
13141328
if clear:
13151329
if not line_sender_flush(self._impl, c_buf, &err):
1316-
raise c_err_to_py(err)
1330+
raise c_err_to_py_fmt(err, _FLUSH_FMT)
13171331
else:
13181332
if not line_sender_flush_and_keep(self._impl, c_buf, &err):
1319-
raise c_err_to_py(err)
1333+
raise c_err_to_py_fmt(err, _FLUSH_FMT)
13201334
except:
13211335
# Prevent a follow-up call to `.close(flush=True)` (as is usually
13221336
# called from `__exit__`) to raise after the sender entered an error

test/test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def test_auto_flush_on_closed_socket(self):
327327
with qi.Sender('localhost', server.port, auto_flush=True) as sender:
328328
server.accept()
329329
server.close()
330-
exp_err = 'Could not flush buffer'
330+
exp_err = 'Could not flush buffer.* - See https'
331331
with self.assertRaisesRegex(qi.IngressError, exp_err):
332332
for _ in range(1000):
333333
time.sleep(0.01)

0 commit comments

Comments
 (0)