crate 2.1.0.dev0__tar.gz → 2.1.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. crate-2.1.0.dev2/.gitignore +23 -0
  2. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/CHANGES.rst +10 -2
  3. crate-2.1.0.dev2/DEVELOP.rst +130 -0
  4. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/PKG-INFO +13 -46
  5. crate-2.1.0.dev2/docs/.gitignore +1 -0
  6. crate-2.1.0.dev2/docs/Makefile +159 -0
  7. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/blobs.rst +0 -5
  8. crate-2.1.0.dev2/docs/build.json +5 -0
  9. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/client.rst +9 -11
  10. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/connection.rst +0 -6
  11. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/cursor.rst +0 -6
  12. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/http.rst +11 -19
  13. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/https.rst +17 -23
  14. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/index.rst +0 -4
  15. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/connect.rst +6 -5
  16. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/data-types.rst +0 -5
  17. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/getting-started.rst +0 -5
  18. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/index.rst +7 -50
  19. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/query.rst +0 -5
  20. crate-2.1.0.dev2/examples/README.rst +9 -0
  21. crate-2.1.0.dev2/pyproject.toml +184 -0
  22. crate-2.1.0.dev2/tests/assets/import/test_a.json +13 -0
  23. crate-2.1.0.dev2/tests/assets/mappings/locations.sql +13 -0
  24. crate-2.1.0.dev2/tests/assets/pki/Makefile +7 -0
  25. crate-2.1.0.dev2/tests/assets/pki/ca.key +28 -0
  26. crate-2.1.0.dev2/tests/assets/pki/ca.pem +22 -0
  27. crate-2.1.0.dev2/tests/assets/pki/cacert.pem +22 -0
  28. crate-2.1.0.dev2/tests/assets/pki/cacert_invalid.pem +34 -0
  29. crate-2.1.0.dev2/tests/assets/pki/cacert_invalid.srl +1 -0
  30. crate-2.1.0.dev2/tests/assets/pki/cacert_valid.pem +48 -0
  31. crate-2.1.0.dev2/tests/assets/pki/cacert_valid.srl +1 -0
  32. crate-2.1.0.dev2/tests/assets/pki/client.pem +21 -0
  33. crate-2.1.0.dev2/tests/assets/pki/client_invalid.pem +48 -0
  34. crate-2.1.0.dev2/tests/assets/pki/client_valid.pem +47 -0
  35. crate-2.1.0.dev2/tests/assets/pki/invalid-key.pem +28 -0
  36. crate-2.1.0.dev2/tests/assets/pki/invalid.csr +17 -0
  37. crate-2.1.0.dev2/tests/assets/pki/invalid.pem +20 -0
  38. crate-2.1.0.dev2/tests/assets/pki/invalid_cert.pem +21 -0
  39. crate-2.1.0.dev2/tests/assets/pki/invalid_key.pem +28 -0
  40. crate-2.1.0.dev2/tests/assets/pki/key.pem +28 -0
  41. crate-2.1.0.dev2/tests/assets/pki/localhost/cert.pem +19 -0
  42. crate-2.1.0.dev2/tests/assets/pki/localhost/key.pem +28 -0
  43. crate-2.1.0.dev2/tests/assets/pki/minica-key.pem +28 -0
  44. crate-2.1.0.dev2/tests/assets/pki/minica.pem +20 -0
  45. crate-2.1.0.dev2/tests/assets/pki/minica.srl +1 -0
  46. crate-2.1.0.dev2/tests/assets/pki/readme.rst +78 -0
  47. crate-2.1.0.dev2/tests/assets/pki/request.csr +17 -0
  48. crate-2.1.0.dev2/tests/assets/pki/server.key +28 -0
  49. crate-2.1.0.dev2/tests/assets/pki/server.pem +20 -0
  50. crate-2.1.0.dev2/tests/assets/pki/server_valid.pem +47 -0
  51. crate-2.1.0.dev2/tests/assets/settings/test_a.json +6 -0
  52. crate-2.1.0.dev2/tests/client/__init__.py +0 -0
  53. crate-2.1.0.dev0/src/crate/client/__init__.py → crate-2.1.0.dev2/tests/client/settings.py +21 -13
  54. crate-2.1.0.dev2/tests/client/test_blob.py +54 -0
  55. crate-2.1.0.dev2/tests/client/test_connection.py +169 -0
  56. crate-2.1.0.dev2/tests/client/test_cursor.py +526 -0
  57. crate-2.1.0.dev2/tests/client/test_exceptions.py +17 -0
  58. crate-2.1.0.dev2/tests/client/test_http.py +737 -0
  59. crate-2.1.0.dev2/tests/client/test_serialization.py +138 -0
  60. crate-2.1.0.dev2/tests/client/test_utils.py +85 -0
  61. crate-2.1.0.dev2/tests/conftest.py +308 -0
  62. crate-2.1.0.dev2/tests/test_docs.py +37 -0
  63. crate-2.1.0.dev2/tests/testing/__init__.py +0 -0
  64. crate-2.1.0.dev2/tests/testing/test_datetime_old.py +90 -0
  65. crate-2.1.0.dev2/tests/testing/test_layer.py +327 -0
  66. crate-2.1.0.dev0/DEVELOP.rst +0 -176
  67. crate-2.1.0.dev0/MANIFEST.in +0 -5
  68. crate-2.1.0.dev0/pyproject.toml +0 -109
  69. crate-2.1.0.dev0/requirements.txt +0 -4
  70. crate-2.1.0.dev0/setup.cfg +0 -4
  71. crate-2.1.0.dev0/setup.py +0 -101
  72. crate-2.1.0.dev0/src/crate/client/_pep440.py +0 -1
  73. crate-2.1.0.dev0/src/crate/client/blob.py +0 -105
  74. crate-2.1.0.dev0/src/crate/client/connection.py +0 -230
  75. crate-2.1.0.dev0/src/crate/client/converter.py +0 -143
  76. crate-2.1.0.dev0/src/crate/client/cursor.py +0 -321
  77. crate-2.1.0.dev0/src/crate/client/exceptions.py +0 -101
  78. crate-2.1.0.dev0/src/crate/client/http.py +0 -712
  79. crate-2.1.0.dev0/src/crate/testing/layer.py +0 -428
  80. crate-2.1.0.dev0/src/crate/testing/util.py +0 -95
  81. crate-2.1.0.dev0/src/crate.egg-info/PKG-INFO +0 -168
  82. crate-2.1.0.dev0/src/crate.egg-info/SOURCES.txt +0 -46
  83. crate-2.1.0.dev0/src/crate.egg-info/dependency_links.txt +0 -1
  84. crate-2.1.0.dev0/src/crate.egg-info/requires.txt +0 -22
  85. crate-2.1.0.dev0/src/crate.egg-info/top_level.txt +0 -1
  86. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/CONTRIBUTING.rst +0 -0
  87. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/LICENSE +0 -0
  88. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/NOTICE +0 -0
  89. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/README.rst +0 -0
  90. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/_extra/robots.txt +0 -0
  91. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/backlog.rst +0 -0
  92. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/by-example/blob.rst +0 -0
  93. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/conf.py +0 -0
  94. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/docutils.conf +0 -0
  95. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/index-all.rst +0 -0
  96. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/other-options.rst +0 -0
  97. {crate-2.1.0.dev0 → crate-2.1.0.dev2}/docs/requirements.txt +0 -0
  98. {crate-2.1.0.dev0/src/crate/testing → crate-2.1.0.dev2/tests}/__init__.py +0 -0
@@ -0,0 +1,23 @@
1
+ .venv*
2
+ .coverage
3
+ coverage.xml
4
+ .idea/
5
+ .installed.cfg
6
+ .tox/
7
+ *.DS_Store
8
+ *.lock
9
+ *.pyc
10
+ bin/*
11
+ !bin/test
12
+ !bin/sphinx
13
+ build/
14
+ crate-python.iml
15
+ crate.egg-info
16
+ develop-eggs/
17
+ dist/
18
+ eggs/
19
+ htmlcov/
20
+ out/
21
+ parts/
22
+ tmp/
23
+ env/
@@ -5,8 +5,16 @@ Changes for crate
5
5
  Unreleased
6
6
  ==========
7
7
 
8
- - Changed connection behaviour to fail early if the database cluster
9
- does not respond
8
+ - Exceptions from the BLOB API now include their full names.
9
+
10
+ - Dropped support for Python versions earlier than 3.10 as they've reached
11
+ their end of life.
12
+
13
+ - Parse path prefixes from server URLs and propagate them to all requests.
14
+
15
+ - Fixed compatibility with ``urllib3-future``.
16
+
17
+ - Added JWT token authentication.
10
18
 
11
19
  2025/01/30 2.0.0
12
20
  ================
@@ -0,0 +1,130 @@
1
+ ==============================
2
+ CrateDB Python developer guide
3
+ ==============================
4
+
5
+ Setup
6
+ =====
7
+
8
+ Clone the repository::
9
+
10
+ git clone https://github.com/crate/crate-python
11
+ cd crate-python
12
+
13
+ Setup a virtualenv and install the package::
14
+
15
+ python -m venv .venv
16
+ source .venv/bin/activate
17
+ python -m pip install --group dev --group docs -e .
18
+
19
+ Or if using `uv`_::
20
+
21
+ uv venv .venv
22
+ source .venv/bin/activate
23
+ uv pip install --group dev --group docs -e .
24
+
25
+
26
+ Running tests
27
+ =============
28
+
29
+ Ensure the virtualenv is active and run tests using `pytest`_::
30
+
31
+ python -m pytest
32
+
33
+
34
+ See also:
35
+
36
+ - `How to invoke pytest <https://docs.pytest.org/en/stable/how-to/usage.html>` for more information.
37
+
38
+
39
+ Formatting and linting code
40
+ ===========================
41
+
42
+ Use `ruff`_ for code formatting and linting::
43
+
44
+ ruff format --check .
45
+ ruff check .
46
+
47
+
48
+ Use ``mypy`` for type checking::
49
+
50
+ mypy
51
+
52
+ Renew certificates
53
+ ==================
54
+
55
+ For conducting TLS connectivity tests, there are a few X.509 certificates at
56
+ `tests/assets/pki/*.pem`_. In order to renew them, follow the instructions
57
+ within the README file in this folder.
58
+
59
+
60
+ Preparing a release
61
+ ===================
62
+
63
+ To create a new release, you must:
64
+
65
+ - Backport your bug fixes to the latest stable branch x.y (e.g. 0.19)
66
+
67
+ - For new features, create a new stable branch x.(y+1) (e.g. 0.20)
68
+
69
+ In the release branch:
70
+
71
+ - Add a section for the new version in the ``CHANGES.rst`` file
72
+
73
+ - Commit your changes with a message like "Release x.y.z"
74
+
75
+ - Push to origin/<release_branch>
76
+
77
+ - Create a tag by running ``git tag -s <version>`` and push it ``git push --tags``.
78
+ This will trigger a Github action which releases the new version to PyPI.
79
+
80
+ - Announce the new release on the `GitHub Releases`_ page.
81
+
82
+ On branch ``main``:
83
+
84
+ - Update the release notes to reflect the release
85
+
86
+ Next:
87
+
88
+ - Archive docs for old releases (see section below)
89
+
90
+ Archiving docs versions
91
+ -----------------------
92
+
93
+ Check the `versions hosted on ReadTheDocs`_.
94
+
95
+ We should only be hosting the docs for `latest`, `stable`, and the most recent
96
+ patch versions for the last two minor releases.
97
+
98
+ To make changes to the RTD configuration (e.g., to activate or deactivate a
99
+ release version), please contact the `@crate/docs`_ team.
100
+
101
+ Writing documentation
102
+ =====================
103
+
104
+ The docs live under the ``docs`` directory.
105
+
106
+ The docs are written with ReStructuredText_ and processed with Sphinx_.
107
+
108
+ Build the docs by running::
109
+
110
+ ./bin/sphinx
111
+
112
+ The output can then be found in the ``out/html`` directory.
113
+
114
+ The docs are automatically built from Git by `Read the Docs`_ and there is
115
+ nothing special you need to do to get the live docs to update.
116
+
117
+ .. _@crate/docs: https://github.com/orgs/crate/teams/docs
118
+ .. _GitHub Releases: https://github.com/crate/crate-python/releases
119
+ .. _PyPI: https://pypi.python.org/pypi
120
+ .. _Python versions: https://docs.astral.sh/uv/concepts/python-versions/
121
+ .. _Read the Docs: http://readthedocs.org
122
+ .. _ReStructuredText: http://docutils.sourceforge.net/rst.html
123
+ .. _Sphinx: http://sphinx-doc.org/
124
+ .. _tests/assets/pki/*.pem: https://github.com/crate/crate-python/tree/main/tests/assets/pki
125
+ .. _twine: https://pypi.python.org/pypi/twine
126
+ .. _useful command-line options for zope-testrunner: https://pypi.org/project/zope.testrunner/#some-useful-command-line-options-to-get-you-started
127
+ .. _uv: https://docs.astral.sh/uv/
128
+ .. _UV_PYTHON: https://docs.astral.sh/uv/configuration/environment/#uv_python
129
+ .. _versions hosted on ReadTheDocs: https://readthedocs.org/projects/crate-python/versions/
130
+ .. _pytest: https://docs.pytest.org/en/stable/
@@ -1,66 +1,33 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crate
3
- Version: 2.1.0.dev0
3
+ Version: 2.1.0.dev2
4
4
  Summary: CrateDB Python Client
5
- Home-page: https://github.com/crate/crate-python
6
- Author: Crate.io
7
- Author-email: office@crate.io
8
- License: Apache License 2.0
9
- Keywords: cratedb db api dbapi database sql http rdbms olap
10
- Platform: any
5
+ Author-email: "Crate.io" <office@crate.io>
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE
11
9
  Classifier: Development Status :: 5 - Production/Stable
12
10
  Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
11
  Classifier: Operating System :: OS Independent
15
12
  Classifier: Programming Language :: Python
16
13
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.6
18
- Classifier: Programming Language :: Python :: 3.7
19
- Classifier: Programming Language :: Python :: 3.8
20
- Classifier: Programming Language :: Python :: 3.9
21
14
  Classifier: Programming Language :: Python :: 3.10
22
15
  Classifier: Programming Language :: Python :: 3.11
23
16
  Classifier: Programming Language :: Python :: 3.12
24
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
25
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
26
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
+ Classifier: Programming Language :: SQL
27
22
  Classifier: Topic :: Database
28
- Requires-Python: >=3.6
29
- Description-Content-Type: text/x-rst
30
- License-File: LICENSE
31
- License-File: NOTICE
32
- Requires-Dist: orjson<4
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
25
+ Classifier: Topic :: System :: Networking
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: orjson
33
28
  Requires-Dist: urllib3
34
29
  Requires-Dist: verlib2
35
- Provides-Extra: doc
36
- Requires-Dist: crate-docs-theme>=0.26.5; extra == "doc"
37
- Requires-Dist: sphinx<9,>=3.5; extra == "doc"
38
- Provides-Extra: test
39
- Requires-Dist: backports.zoneinfo<1; python_version < "3.9" and extra == "test"
40
- Requires-Dist: certifi; extra == "test"
41
- Requires-Dist: createcoverage<2,>=1; extra == "test"
42
- Requires-Dist: mypy<1.16; extra == "test"
43
- Requires-Dist: poethepoet<1; extra == "test"
44
- Requires-Dist: ruff<0.12; extra == "test"
45
- Requires-Dist: stopit<2,>=1.1.2; extra == "test"
46
- Requires-Dist: pytz; extra == "test"
47
- Requires-Dist: zc.customdoctests<2,>=1.0.1; extra == "test"
48
- Requires-Dist: zope.testing<6,>=4; extra == "test"
49
- Requires-Dist: zope.testrunner<8,>=5; extra == "test"
50
- Dynamic: author
51
- Dynamic: author-email
52
- Dynamic: classifier
53
- Dynamic: description
54
- Dynamic: description-content-type
55
- Dynamic: home-page
56
- Dynamic: keywords
57
- Dynamic: license
58
- Dynamic: license-file
59
- Dynamic: platform
60
- Dynamic: provides-extra
61
- Dynamic: requires-dist
62
- Dynamic: requires-python
63
- Dynamic: summary
30
+ Description-Content-Type: text/x-rst
64
31
 
65
32
  =====================
66
33
  CrateDB Python Client
@@ -0,0 +1 @@
1
+ .crate-docs
@@ -0,0 +1,159 @@
1
+ # Licensed to Crate (https://crate.io) under one or more contributor license
2
+ # agreements. See the NOTICE file distributed with this work for additional
3
+ # information regarding copyright ownership. Crate licenses this file to you
4
+ # under the Apache License, Version 2.0 (the "License"); you may not use this
5
+ # file except in compliance with the License. You may obtain a copy of the
6
+ # License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+ #
16
+ # However, if you have executed another commercial license agreement with Crate
17
+ # these terms will supersede the license and you may use the software solely
18
+ # pursuant to the terms of the relevant commercial agreement.
19
+
20
+
21
+ # =============================================================================
22
+ # Crate Docs
23
+ # =============================================================================
24
+
25
+ # The Crate Docs project provides a common set of tools for producing the
26
+ # Crate.io documentation. See <https://github.com/crate/crate-docs/> for more
27
+ # information.
28
+
29
+ # This file is taken from the demo Sphinx project available at
30
+ # <https://github.com/crate/crate-docs/blob/main/docs>. This demo docs project
31
+ # provides a reference implementation that should be copied for all Sphinx
32
+ # projects at Crate.io.
33
+
34
+ # The Crate Docs build system works by centralizing its core components in the
35
+ # `crate-docs` repository. At build time, this Makefile creates a copy of the
36
+ # this project under the `.crate-docs` directory. This Makefile is an interface
37
+ # for those core components.
38
+
39
+
40
+ # Upgraded instructions
41
+ # -----------------------------------------------------------------------------
42
+
43
+ # You must pin your Sphinx project to a specific version of the Crate Docs
44
+ # project. You can do this by editing the `build.json` file. Change the JSON
45
+ # `message` value to the desired release number. A list of releases is
46
+ # available at <https://github.com/crate/crate-docs/releases>.
47
+
48
+ # Although care has been taken to restrict changes to the core components, you
49
+ # may occasionally need to update your project to match the reference
50
+ # implementation. Check the release notes for any special instructions.
51
+
52
+
53
+ # Project-specific customization
54
+ # =============================================================================
55
+
56
+ # If you want to customize the build system for your Sphinx project, add lines
57
+ # to this section.
58
+
59
+
60
+ # Build system integration
61
+ # =============================================================================
62
+
63
+ # This is a boilerplate section is required for integration with the Crate Docs
64
+ # build system. All Sphinx projects using a the same Crate Docs version
65
+ # should have exactly the same boilerplate.
66
+
67
+ # IF YOU ARE EDITING THIS FILE IN A REAL SPHINX PROJECT, YOU SHOULD NOT MAKE
68
+ # ANY CHANGES TO THIS SECTION.
69
+
70
+ # If you want to make changes to the boilerplate, please make a pull request on
71
+ # the demo Sphinx project in the Crate Docs repository available at
72
+ # <https://github.com/crate/crate-docs/blob/main/docs>.
73
+
74
+ .EXPORT_ALL_VARIABLES:
75
+
76
+ DOCS_DIR := docs
77
+ TOP_DIR := ..
78
+ BUILD_JSON := build.json
79
+ BUILD_REPO := https://github.com/crate/crate-docs.git
80
+ LATEST_BUILD := https://github.com/crate/crate-docs/releases/latest
81
+ CLONE_DIR := .crate-docs
82
+ SRC_DIR := $(CLONE_DIR)/common-build
83
+ SELF_SRC := $(TOP_DIR)/common-build
84
+ SELF_MAKEFILE := $(SELF_SRC)/rules.mk
85
+ SRC_MAKE := $(MAKE) -f $(SRC_DIR)/rules.mk
86
+
87
+ # Parse the JSON file
88
+ BUILD_VERSION := $(shell cat $(BUILD_JSON) | \
89
+ python3 -c 'import json, sys; print(json.load(sys.stdin)["message"])')
90
+
91
+ ifeq ($(BUILD_VERSION),)
92
+ $(error No build version specified in `$(BUILD_JSON)`.)
93
+ endif
94
+
95
+ # This is a non-essential check so we timeout after only two seconds so as not
96
+ # to frustrate the user when there are network issues
97
+ LATEST_VERSION := $(shell curl -sI --connect-timeout 2 '$(LATEST_BUILD)' | \
98
+ grep -i 'Location:' | grep -Eoh '[^/]+$$')
99
+
100
+ # Skip if no version could be determined (i.e., because of a network error)
101
+ ifneq ($(LATEST_VERSION),)
102
+ # Only issue a warning if there is a version mismatch
103
+ ifneq ($(BUILD_VERSION),$(LATEST_VERSION))
104
+ define version_warning
105
+ You are using Crate Docs version $(BUILD_VERSION), however version \
106
+ $(LATEST_VERSION) is available. You should consider upgrading. Follow the \
107
+ instructions in `Makefile` and then run `make reset`.
108
+ endef
109
+ endif
110
+ endif
111
+
112
+ # Default rule
113
+ .PHONY: help
114
+ help: $(CLONE_DIR)
115
+ @ $(MAKE) version-warn
116
+ @ $(SRC_MAKE) $@
117
+
118
+ .PHONY: version-warn
119
+ version-warn:
120
+ @ # Because version numbers may vary in length, we must wrap the warning
121
+ @ # message at run time to be sure of correct output
122
+ @ if test -n '$(version_warning)'; then \
123
+ printf '\033[33m'; \
124
+ echo '$(version_warning)' | fold -w 79 -s; \
125
+ printf '\033[00m\n'; \
126
+ fi
127
+
128
+ ifneq ($(wildcard $(SELF_MAKEFILE)),)
129
+ # The project detects itself and fakes an install of its own core build rules
130
+ # so that it can test itself
131
+ $(CLONE_DIR):
132
+ @ printf '\033[1mInstalling the build system...\033[00m\n'
133
+ @ mkdir -p $@
134
+ @ cp -R $(SELF_SRC) $(SRC_DIR)
135
+ @ printf 'Created: $(CLONE_DIR)\n'
136
+ else
137
+ # All other projects install a versioned copy of the core build rules
138
+ $(CLONE_DIR):
139
+ @ printf '\033[1mInstalling the build system...\033[00m\n'
140
+ @ git clone --depth=1 -c advice.detachedHead=false \
141
+ --branch=$(BUILD_VERSION) $(BUILD_REPO) $(CLONE_DIR)
142
+ @ printf 'Created: $(CLONE_DIR)\n'
143
+ endif
144
+
145
+ # Don't pass through this target
146
+ .PHONY: Makefile
147
+ Makefile:
148
+
149
+ # By default, pass targets through to the core build rules
150
+ .PHONY:
151
+ %: $(CLONE_DIR)
152
+ @ $(MAKE) version-warn
153
+ @ $(SRC_MAKE) $@
154
+
155
+ .PHONY: reset
156
+ reset:
157
+ @ printf '\033[1mResetting the build system...\033[00m\n'
158
+ @ rm -rf $(CLONE_DIR)
159
+ @ printf 'Removed: $(CLONE_DIR)\n'
@@ -8,11 +8,6 @@ The CrateDB Python client library provides full access to the powerful
8
8
  :ref:`blob storage capabilities <crate-reference:blob_support>` of your
9
9
  CrateDB cluster.
10
10
 
11
- .. rubric:: Table of contents
12
-
13
- .. contents::
14
- :local:
15
-
16
11
  Get a blob container
17
12
  ====================
18
13
 
@@ -0,0 +1,5 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "label": "docs build",
4
+ "message": "2.1.5"
5
+ }
@@ -7,12 +7,6 @@ Python. This section of the documentation outlines different methods to connect
7
7
  to the database cluster, as well as how to run basic inquiries to the database,
8
8
  and closing the connection again.
9
9
 
10
- .. rubric:: Table of Contents
11
-
12
- .. contents::
13
- :local:
14
-
15
-
16
10
  Connect to a database
17
11
  =====================
18
12
 
@@ -31,12 +25,16 @@ replication. In order for clients to make use of this property it is
31
25
  recommended to specify all hosts of the cluster. This way if a server does not
32
26
  respond, the request is automatically routed to the next server:
33
27
 
34
- >>> invalid_host = 'http://not_responding_host:4200'
28
+ >>> invalid_host = 'http://127.0.0.1:4201'
35
29
  >>> connection = client.connect([invalid_host, crate_host])
36
30
  >>> connection.close()
37
31
 
38
- If no ``servers`` are supplied to the ``connect`` method, the default address
39
- ``http://127.0.0.1:4200`` is used.
32
+ If no ``servers`` are given, the default one ``http://127.0.0.1:4200`` is used:
33
+
34
+ >>> connection = client.connect()
35
+ >>> connection.client._active_servers
36
+ ['http://127.0.0.1:4200']
37
+ >>> connection.close()
40
38
 
41
39
  If the option ``error_trace`` is set to ``True``, the client will print a whole
42
40
  traceback if a server error occurs:
@@ -51,7 +49,7 @@ It's possible to define a default timeout value in seconds for all servers
51
49
  using the optional parameter ``timeout``. In this case, it will serve as a
52
50
  total timeout (connect and read):
53
51
 
54
- >>> connection = client.connect([crate_host, invalid_host], timeout=5)
52
+ >>> connection = client.connect([crate_host, invalid_host], timeout=1)
55
53
  >>> connection.close()
56
54
 
57
55
  If you want to adjust the connect- vs. read-timeout values individually,
@@ -60,7 +58,7 @@ please use the ``urllib3.Timeout`` object like:
60
58
  >>> import urllib3
61
59
  >>> connection = client.connect(
62
60
  ... [crate_host, invalid_host],
63
- ... timeout=urllib3.Timeout(connect=5, read=None))
61
+ ... timeout=urllib3.Timeout(connect=1, read=None))
64
62
  >>> connection.close()
65
63
 
66
64
  Authentication
@@ -9,12 +9,6 @@ The examples use an instance of ``ClientMocked`` instead of a real ``Client``
9
9
  instance. This allows us to verify the examples without needing a real database
10
10
  connection.
11
11
 
12
- .. rubric:: Table of Contents
13
-
14
- .. contents::
15
- :local:
16
-
17
-
18
12
  connect()
19
13
  =========
20
14
 
@@ -8,12 +8,6 @@ behaviors of the ``crate.client.cursor.Cursor`` object.
8
8
  The example code uses ``ClientMocked`` and ``set_next_response`` for
9
9
  demonstration purposes, so they don't need a real database connection.
10
10
 
11
- .. rubric:: Table of Contents
12
-
13
- .. contents::
14
- :local:
15
-
16
-
17
11
  Introduction
18
12
  ============
19
13
 
@@ -2,12 +2,6 @@
2
2
  HTTP client
3
3
  ===========
4
4
 
5
- .. rubric:: Table of Contents
6
-
7
- .. contents::
8
- :local:
9
-
10
-
11
5
  Introduction
12
6
  ============
13
7
 
@@ -40,23 +34,23 @@ If no ``server`` argument (or no argument at all) is passed, the default one
40
34
 
41
35
  When using a list of servers, the servers are selected by round-robin:
42
36
 
43
- >>> invalid_host = "invalid_host:9999"
44
- >>> even_more_invalid_host = "even_more_invalid_host:9999"
45
- >>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host], timeout=0.3)
37
+ >>> invalid_host1 = "192.0.2.1:9999"
38
+ >>> invalid_host2 = "192.0.2.2:9999"
39
+ >>> http_client = HttpClient([crate_host, invalid_host1, invalid_host2], timeout=0.3)
46
40
  >>> http_client._get_server()
47
41
  'http://127.0.0.1:44209'
48
42
 
49
43
  >>> http_client._get_server()
50
- 'http://invalid_host:9999'
44
+ 'http://192.0.2.1:9999'
51
45
 
52
46
  >>> http_client._get_server()
53
- 'http://even_more_invalid_host:9999'
47
+ 'http://192.0.2.2:9999'
54
48
 
55
49
  >>> http_client.close()
56
50
 
57
51
  Servers with connection errors will be removed from the active server list:
58
52
 
59
- >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host], timeout=0.3)
53
+ >>> http_client = HttpClient([invalid_host1, invalid_host2, crate_host], timeout=0.3)
60
54
  >>> result = http_client.sql('select name from locations')
61
55
  >>> http_client._active_servers
62
56
  ['http://127.0.0.1:44209']
@@ -70,19 +64,17 @@ sleep after the first request::
70
64
  >>> import time; time.sleep(1)
71
65
  >>> server = http_client._get_server()
72
66
  >>> http_client._active_servers
73
- ['http://invalid_host:9999',
74
- 'http://even_more_invalid_host:9999',
75
- 'http://127.0.0.1:44209']
67
+ ['http://127.0.0.1:44209', 'http://192.0.2.2:9999', 'http://192.0.2.1:9999']
76
68
  >>> http_client.close()
77
69
 
78
70
  If no active servers are available and the retry interval is not reached, just use the oldest
79
71
  inactive one:
80
72
 
81
- >>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host], timeout=0.3)
73
+ >>> http_client = HttpClient([invalid_host1, invalid_host2, crate_host], timeout=0.3)
82
74
  >>> result = http_client.sql('select name from locations')
83
75
  >>> http_client._active_servers = []
84
76
  >>> http_client._get_server()
85
- 'http://invalid_host:9999'
77
+ 'http://192.0.2.1:9999'
86
78
  >>> http_client.close()
87
79
 
88
80
  SQL Statements
@@ -124,7 +116,7 @@ Trying to get a non-existing blob throws an exception:
124
116
  >>> http_client.blob_get('myfiles', '041f06fd774092478d450774f5ba30c5da78acc8')
125
117
  Traceback (most recent call last):
126
118
  ...
127
- crate.client.exceptions.DigestNotFoundException: myfiles/041f06fd774092478d450774f5ba30c5da78acc8
119
+ crate.client.exceptions.DigestNotFoundException: DigestNotFoundException('myfiles/041f06fd774092478d450774f5ba30c5da78acc8')
128
120
 
129
121
  Creating a new blob - this method returns ``True`` if the blob was newly created:
130
122
 
@@ -179,7 +171,7 @@ Uploading a blob to a table with disabled blob support throws an exception:
179
171
  ... 'locations', '040f06fd774092478d450774f5ba30c5da78acc8', f)
180
172
  Traceback (most recent call last):
181
173
  ...
182
- crate.client.exceptions.BlobLocationNotFoundException: locations/040f06fd774092478d450774f5ba30c5da78acc8
174
+ crate.client.exceptions.BlobLocationNotFoundException: BlobLocationNotFoundException('locations/040f06fd774092478d450774f5ba30c5da78acc8')
183
175
 
184
176
  >>> http_client.close()
185
177
  >>> f.close()