Skip to content

BREAKING: New ILP/HTTP and Sender.from_conf API #59

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

Merged
merged 89 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
58adf9c
feat: ILP/HTTP
amunra Jan 3, 2024
1e4dd4e
inital impl of basic_auth, token_auth and http flag
amunra Jan 3, 2024
9839061
A first HTTP test
amunra Jan 4, 2024
550fc84
CI changes to run vs questdb master
amunra Jan 4, 2024
2297f4c
ci fix (hopefully)
amunra Jan 4, 2024
e497d2e
winging another ci fix
amunra Jan 4, 2024
42a1f4d
another CI fix
amunra Jan 4, 2024
07363ca
another ci fix
amunra Jan 4, 2024
ff00e32
updated to latest c-questdb-client changes
amunra Jan 4, 2024
9751959
New auto_flush flag logic, no tests yet
amunra Jan 5, 2024
d2f6034
sync to latest c-questdb-client master commit
amunra Jan 5, 2024
674df7f
fix pandas 2.0 warnings
amunra Feb 22, 2024
c03b0bb
First pass at adding large_string support, passing on pandas==2.2.0
nwoolmer Feb 26, 2024
47895ae
Add case to check for long_string
nwoolmer Feb 26, 2024
24d58f3
Removed version check, replace with format check and refactor names t…
nwoolmer Feb 26, 2024
4d71a02
CI update to verify run against pre and post pandas 2.0.
nwoolmer Feb 26, 2024
584ae7b
Get rid of debug print.
nwoolmer Feb 26, 2024
3e5c2eb
Naming
nwoolmer Feb 26, 2024
a2dbde0
Addressing comments and iterating on CI
nwoolmer Feb 27, 2024
0dbbd49
Iterating on CI
nwoolmer Feb 27, 2024
e8b487e
Iterating on CI
nwoolmer Feb 27, 2024
e4c3c09
Debugging CI
nwoolmer Feb 27, 2024
8bc90fb
Debugging CI
nwoolmer Feb 27, 2024
a222f50
Debugging CI
nwoolmer Feb 27, 2024
91a93e9
Debugging CI
nwoolmer Feb 27, 2024
13474ac
neq -> ne
nwoolmer Feb 27, 2024
84e3a6c
Merge pull request #63 from questdb/nw_large_string_support
amunra Feb 27, 2024
6e1bf23
partial progress with conf str API
amunra Mar 1, 2024
f7deec4
progress with ILP/HTTP
amunra Mar 4, 2024
13b97d9
First pass at mnaking 'at' kwarg mandatory, testing TBA
nwoolmer Mar 4, 2024
93751df
WIP: initial code to use the questdb-confstr-ffi API from Python
amunra Mar 4, 2024
61fa069
Merge remote-tracking branch 'origin/ilp_http' into nw_required_kw_param
nwoolmer Mar 4, 2024
4ad19dd
Testing and debugging
nwoolmer Mar 5, 2024
952e3d3
updated submodule
amunra Mar 5, 2024
f70db1f
Push down ServerTimestamp -> None remap down an API level, and more t…
nwoolmer Mar 5, 2024
f69e023
Merge branch 'ilp_http' into nw_required_kw_param
nwoolmer Mar 5, 2024
7df9d7c
WIP: from conf_str and from_env implemented (some bugs outstanding)
amunra Mar 5, 2024
71b2732
fixed a test
amunra Mar 5, 2024
1955dd3
more testing magic
amunra Mar 5, 2024
daab935
HTTP user agent
amunra Mar 6, 2024
1637771
sender.transaction()
amunra Mar 7, 2024
1f4aa5f
some initial http unit testing
amunra Mar 7, 2024
7289677
more sender.transaction() testing
amunra Mar 7, 2024
5c949d0
more sender.transaction and auto_flush testing
amunra Mar 8, 2024
b145c12
auto_flush_rows testing
amunra Mar 8, 2024
09b0278
test auto_flush_interval
amunra Mar 8, 2024
e4ba56e
testing http auth
amunra Mar 8, 2024
794b09a
submodule update
amunra Mar 11, 2024
068870f
submodule update
amunra Mar 11, 2024
72ba292
init_capacity -> init_buf_size rename
amunra Mar 11, 2024
694861f
submodule update
amunra Mar 11, 2024
4d85d0f
updated examples
amunra Mar 11, 2024
9d7d0d2
Added a test for 'max_buf_size'
amunra Mar 11, 2024
d665c3c
added 'from_conf' example with manifest
amunra Mar 11, 2024
d4f3ba6
test improvements
amunra Mar 11, 2024
fcbf22f
refactoring
amunra Mar 11, 2024
8036889
http dataframe testing
amunra Mar 11, 2024
33384e7
fixing tests and refreshing submodule
amunra Mar 12, 2024
d000f7c
another attempt fixing test_auto_flush_interval
amunra Mar 12, 2024
c389235
skipping dataframe tests where pandas is not available
amunra Mar 12, 2024
4b9c91d
split out tls_proxy compile to separate command
amunra Mar 12, 2024
2f1c92f
reattempting flaky test in loop
amunra Mar 12, 2024
bc00ea4
detritis removal
amunra Mar 12, 2024
9f3351d
testing examples.manifest.yaml
amunra Mar 12, 2024
010aa95
example fixes and new http_transaction example
amunra Mar 12, 2024
e6c8db0
hardened sender.transaction(..) agains accidental misuse
amunra Mar 12, 2024
7b5af50
updated auto_flush_rows default to 600 for TCP
amunra Mar 12, 2024
4033fbe
doc tweaks
amunra Mar 12, 2024
c702360
Refactored tests to use TestBases rather than using a metaclass
amunra Mar 13, 2024
cdb4deb
API doc tweak
amunra Mar 13, 2024
ade8392
docs
amunra Mar 13, 2024
fa51b92
doc fix
amunra Mar 13, 2024
3701f8e
fixed auto_flush argument parsing to be in line with docs
amunra Mar 13, 2024
c6beedd
fixing flaky CI tests
amunra Mar 13, 2024
3edce5a
test and string parsing fixes for auto_flush params
amunra Mar 13, 2024
67a30c4
Make sure at=None cannot be submitted to row() and dataframe() APIs
nwoolmer Mar 14, 2024
50b7f4d
Test debug
nwoolmer Mar 14, 2024
ca58748
Elide if pandas not installed
nwoolmer Mar 14, 2024
dbf7643
submodule update and ci code style clean-up
amunra Mar 15, 2024
4848ba8
A heap of doc changes
amunra Mar 15, 2024
230336a
tiny bugfix
amunra Mar 15, 2024
6022fb0
more doc fixes
amunra Mar 15, 2024
10534bc
probably final doc tweaks
amunra Mar 15, 2024
5039739
fixed a typo
amunra Mar 15, 2024
d59dd72
tweaks
amunra Mar 15, 2024
1408070
one for the road
amunra Mar 15, 2024
5376386
updated submodule
amunra Mar 18, 2024
0cf351a
Merge branch 'ilp_http' of https://github.com/questdb/py-questdb-clie…
amunra Mar 18, 2024
ea251d9
bumpversion fix
amunra Mar 18, 2024
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
4 changes: 2 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bumpversion:file:src/questdb/ingress.pyx]
search = 'v{current_version}'
replace = 'v{new_version}'
search = 'VERSION = "{current_version}"'
replace = 'VERSION = "{new_version}"'
16 changes: 13 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ The latest version of the library is 1.2.0.

::

python3 -m pip install questdb
python3 -m pip install -U questdb

.. code-block:: python

from questdb.ingress import Sender, TimestampNanos

with Sender('localhost', 9009) as sender:
conf = f'tcp::addr=localhost:9009;'
with Sender.from_conf(conf) as sender:
sender.row(
'sensors',
symbols={'id': 'toronto1'},
Expand All @@ -48,10 +49,19 @@ You can also send Pandas dataframes:
'humidity': [0.5, 0.6],
'timestamp': pd.to_datetime(['2021-01-01', '2021-01-02'])})

with Sender('localhost', 9009) as sender:
conf = f'tcp::addr=localhost:9009;'
with Sender.from_conf(conf) as sender:
sender.dataframe(df, table_name='sensors', at='timestamp')


To connect via HTTP, set the configuration string to:

.. code-block:: python

conf = f'http::addr=http://localhost:9000;'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

with Sender.from_conf(conf) as sender:
...

Docs
====

Expand Down
2 changes: 1 addition & 1 deletion c-questdb-client
Submodule c-questdb-client updated 63 files
+4 −0 .bumpversion.cfg
+23 −0 CMakeLists.txt
+10 −10 README.md
+1 −1 cbindgen.toml
+14 −0 ci/compile.yaml
+2 −1 ci/run_all_tests.py
+26 −38 ci/run_tests_pipeline.yaml
+1 −1 cpp_test/build_env.h
+1 −1 cpp_test/mock_server.cpp
+1 −1 cpp_test/mock_server.hpp
+171 −28 cpp_test/test_line_sender.cpp
+8 −14 doc/C.md
+15 −5 doc/CONSIDERATIONS.md
+6 −8 doc/CPP.md
+21 −0 examples.manifest.yaml
+19 −0 examples/concat.c
+11 −0 examples/concat.h
+14 −15 examples/line_sender_c_example.c
+19 −31 examples/line_sender_c_example_auth.c
+20 −38 examples/line_sender_c_example_auth_tls.c
+83 −0 examples/line_sender_c_example_from_conf.c
+82 −0 examples/line_sender_c_example_from_env.c
+129 −0 examples/line_sender_c_example_http.c
+21 −40 examples/line_sender_c_example_tls_ca.c
+3 −7 examples/line_sender_cpp_example.cpp
+7 −16 examples/line_sender_cpp_example_auth.cpp
+8 −24 examples/line_sender_cpp_example_auth_tls.cpp
+54 −0 examples/line_sender_cpp_example_from_conf.cpp
+53 −0 examples/line_sender_cpp_example_from_env.cpp
+88 −0 examples/line_sender_cpp_example_http.cpp
+9 −23 examples/line_sender_cpp_example_tls_ca.cpp
+262 −61 include/questdb/ingress/line_sender.h
+350 −72 include/questdb/ingress/line_sender.hpp
+372 −194 questdb-rs-ffi/Cargo.lock
+8 −1 questdb-rs-ffi/Cargo.toml
+497 −147 questdb-rs-ffi/src/lib.rs
+29 −13 questdb-rs/Cargo.toml
+33 −2 questdb-rs/README.md
+12 −14 questdb-rs/examples/auth.rs
+12 −16 questdb-rs/examples/auth_tls.rs
+3 −7 questdb-rs/examples/basic.rs
+17 −0 questdb-rs/examples/from_conf.rs
+18 −0 questdb-rs/examples/from_env.rs
+17 −0 questdb-rs/examples/http.rs
+9 −0 questdb-rs/src/error.rs
+1 −1 questdb-rs/src/gai.rs
+75 −0 questdb-rs/src/ingress/conf.rs
+235 −0 questdb-rs/src/ingress/http.rs
+1,306 −432 questdb-rs/src/ingress/mod.rs
+461 −0 questdb-rs/src/ingress/tests.rs
+1 −1 questdb-rs/src/lib.rs
+1 −1 questdb-rs/src/tests/f64_serializer.rs
+709 −0 questdb-rs/src/tests/http.rs
+411 −91 questdb-rs/src/tests/mock.rs
+5 −1 questdb-rs/src/tests/mod.rs
+176 −26 questdb-rs/src/tests/sender.rs
+86 −16 system_test/fixture.py
+183 −67 system_test/questdb_line_sender.py
+258 −77 system_test/test.py
+167 −153 system_test/tls_proxy/Cargo.lock
+5 −3 system_test/tls_proxy/Cargo.toml
+181 −0 system_test/tls_proxy/src/lib.rs
+4 −108 system_test/tls_proxy/src/main.rs
30 changes: 23 additions & 7 deletions ci/pip_install_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@
import shlex
import textwrap
import platform
import argparse


arg_parser = argparse.ArgumentParser(
prog='pip_install_deps.py',
description='installs dependencies'
)

arg_parser.add_argument('--pandasVersion')

class UnsupportedDependency(Exception):
pass


def pip_install(package):
def pip_install(package, version=None):
args = [
sys.executable,
'-m', 'pip', 'install',
'--upgrade',
'--only-binary', ':all:',
package]
package if version is None else f'{package}=={version}'
]
args_s = ' '.join(shlex.quote(arg) for arg in args)
sys.stderr.write(args_s + '\n')
res = subprocess.run(
Expand All @@ -35,9 +44,9 @@ def pip_install(package):
sys.exit(res.returncode)


def try_pip_install(package):
def try_pip_install(package, version=None):
try:
pip_install(package)
pip_install(package, version)
except UnsupportedDependency as e:
msg = textwrap.indent(str(e), ' ' * 8)
sys.stderr.write(f' Ignored unsatisfiable dependency:\n{msg}\n')
Expand All @@ -52,12 +61,18 @@ def ensure_timezone():
pip_install('pytz')


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

print(f"DEBUG: {args}, pandas: {args.pandasVersion}")

if args.pandasVersion is not None and args.pandasVersion != '':
try_pip_install('pandas', args.pandasVersion)
else:
try_pip_install('pandas')
try_pip_install('numpy')
try_pip_install('pyarrow')

Expand All @@ -80,4 +95,5 @@ def main():


if __name__ == "__main__":
main()
args = arg_parser.parse_args()
main(args)
38 changes: 34 additions & 4 deletions ci/run_tests_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ stages:
linux:
imageName: "ubuntu-latest"
poolName: "Azure Pipelines"
linux-old-pandas:
imageName: "ubuntu-latest"
poolName: "Azure Pipelines"
pandasVersion: "2.1.4"
linux-qdb-master:
imageName: "ubuntu-latest"
poolName: "Azure Pipelines"
vsQuestDbMaster: true
mac:
imageName: "macos-latest"
poolName: "Azure Pipelines"
Expand All @@ -27,14 +35,36 @@ stages:
lfs: false
submodules: true
- task: UsePythonVersion@0
- script: python3 --version
- script: |
python3 --version
python3 -m pip install cython
python3 ci/pip_install_deps.py
displayName: Installing Python dependencies
displayName: "Install cython"
- script: python3 ci/pip_install_deps.py
displayName: "Install pandas latest"
condition: eq(variables.pandasVersion, '')
- script: python3 ci/pip_install_deps.py --pandasVersion==$(pandasVersion)
displayName: "Install pandas older"
condition: ne(variables.pandasVersion, '')
- script: python3 proj.py build
displayName: "Build"
- script: |
git clone --depth 1 https://github.com/questdb/questdb.git
displayName: git clone questdb
condition: eq(variables.vsQuestDbMaster, true)
- task: Maven@3
displayName: "Compile QuestDB"
inputs:
mavenPOMFile: 'questdb/pom.xml'
jdkVersionOption: '1.11'
options: "-DskipTests -Pbuild-web-console"
condition: eq(variables.vsQuestDbMaster, true)
- script: python3 proj.py test 1
displayName: "Test vs released"
env:
JAVA_HOME: $(JAVA_HOME_11_X64)
- script: python3 proj.py test 1
displayName: "Test"
displayName: "Test vs master"
env:
JAVA_HOME: $(JAVA_HOME_11_X64)
QDB_REPO_PATH: './questdb'
condition: eq(variables.vsQuestDbMaster, true)
2 changes: 2 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Here the :class:`questdb.ingress.Sender` is constructed with just ``host`` and
:language: python


.. _auth_and_tls_example:

Authentication and TLS
----------------------

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Contents
:maxdepth: 2

installation
sender
examples
api
troubleshooting
Expand Down
6 changes: 5 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ You can install it (or update it) globally by running::

Or, from within a virtual environment::

pip install questdb
pip install -U questdb


If you're using poetry, you can add ``questdb`` as a dependency::

poetry add questdb

or to update the dependency::

poetry update questdb


Note that the :func:`questdb.ingress.Buffer.dataframe` and the
:func:`questdb.ingress.Sender.dataframe` methods also require the following
Expand Down
Loading