crate 1.0.0__tar.gz → 1.0.0.dev1__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.
- {crate-1.0.0 → crate-1.0.0.dev1}/DEVELOP.rst +13 -42
- {crate-1.0.0 → crate-1.0.0.dev1}/LICENSE +70 -0
- crate-1.0.0.dev1/MANIFEST.in +5 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/NOTICE +1 -1
- {crate-1.0.0 → crate-1.0.0.dev1}/PKG-INFO +6 -21
- {crate-1.0.0 → crate-1.0.0.dev1}/README.rst +1 -1
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/appendices/data-types.rst.txt +158 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/appendices/index.rst.txt +14 -0
- crate-1.0.0/docs/by-example/connection.rst → crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/connection.rst.txt +1 -1
- crate-1.0.0/docs/by-example/cursor.rst → crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/cursor.rst.txt +4 -3
- crate-1.0.0/docs/by-example/http.rst → crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/http.rst.txt +5 -7
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/advanced-querying.rst.txt +335 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/crud.rst.txt +301 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/dataframe.rst.txt +258 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/getting-started.rst.txt +211 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/inspection-reflection.rst.txt +126 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/sqlalchemy/working-with-types.rst.txt +265 -0
- crate-1.0.0/docs/index.rst → crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/index.rst.txt +3 -3
- crate-1.0.0/docs/query.rst → crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/query.rst.txt +2 -1
- crate-1.0.0.dev1/docs/.crate-docs/.build/_static/bundle/main.js.LICENSE.txt +70 -0
- crate-1.0.0.dev1/docs/.crate-docs/.build/output.txt +17 -0
- crate-1.0.0.dev1/docs/.crate-docs/common-build/requirements.txt +10 -0
- crate-1.0.0.dev1/docs/.crate-docs/docs/_extra/robots.txt +2 -0
- crate-1.0.0.dev1/docs/.crate-docs/docs/requirements.txt +2 -0
- crate-1.0.0.dev1/docs/.crate-docs/helpers/preview/etc/requirements.txt +3 -0
- crate-1.0.0.dev1/docs/_extra/robots.txt +4 -0
- crate-1.0.0.dev1/pyproject.toml +5 -0
- crate-1.0.0.dev1/setup.cfg +7 -0
- crate-1.0.0.dev1/setup.py +98 -0
- crate-1.0.0.dev1/src/crate/__init__.py +28 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/__init__.py +3 -3
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/blob.py +7 -9
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/connection.py +52 -58
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/converter.py +10 -15
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/cursor.py +51 -55
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/exceptions.py +3 -5
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/http.py +160 -192
- crate-1.0.0.dev1/src/crate/client/pki/readme.rst +91 -0
- crate-1.0.0.dev1/src/crate/client/test_connection.py +98 -0
- crate-1.0.0.dev1/src/crate/client/test_cursor.py +341 -0
- crate-1.0.0.dev1/src/crate/client/test_exceptions.py +14 -0
- crate-1.0.0.dev1/src/crate/client/test_http.py +678 -0
- crate-1.0.0/src/crate/testing/util.py → crate-1.0.0.dev1/src/crate/client/test_util.py +4 -30
- crate-1.0.0.dev1/src/crate/testing/__init__.py +1 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/testing/layer.py +102 -140
- crate-1.0.0.dev1/src/crate/testing/settings.py +51 -0
- crate-1.0.0.dev1/src/crate/testing/test_datetime_old.py +90 -0
- crate-1.0.0.dev1/src/crate/testing/test_layer.py +290 -0
- crate-1.0.0.dev1/src/crate/testing/util.py +20 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate.egg-info/PKG-INFO +6 -21
- crate-1.0.0.dev1/src/crate.egg-info/SOURCES.txt +70 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate.egg-info/requires.txt +11 -10
- crate-1.0.0.dev1/src/crate.egg-info/top_level.txt +1 -0
- crate-1.0.0/CHANGES.rst +0 -927
- crate-1.0.0/MANIFEST.in +0 -5
- crate-1.0.0/docs/conf.py +0 -35
- crate-1.0.0/docs/docutils.conf +0 -3
- crate-1.0.0/pyproject.toml +0 -102
- crate-1.0.0/requirements.txt +0 -2
- crate-1.0.0/setup.cfg +0 -4
- crate-1.0.0/setup.py +0 -101
- crate-1.0.0/src/crate/__init__.py +0 -0
- crate-1.0.0/src/crate/testing/__init__.py +0 -0
- crate-1.0.0/src/crate.egg-info/SOURCES.txt +0 -48
- {crate-1.0.0 → crate-1.0.0.dev1}/CONTRIBUTING.rst +0 -0
- /crate-1.0.0/docs/backlog.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/backlog.rst.txt +0 -0
- /crate-1.0.0/docs/blobs.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/blobs.rst.txt +0 -0
- /crate-1.0.0/docs/by-example/blob.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/blob.rst.txt +0 -0
- /crate-1.0.0/docs/by-example/client.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/client.rst.txt +0 -0
- /crate-1.0.0/docs/by-example/https.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/https.rst.txt +0 -0
- /crate-1.0.0/docs/by-example/index.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/by-example/index.rst.txt +0 -0
- /crate-1.0.0/docs/connect.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/connect.rst.txt +0 -0
- /crate-1.0.0/docs/data-types.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/data-types.rst.txt +0 -0
- /crate-1.0.0/docs/getting-started.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/getting-started.rst.txt +0 -0
- /crate-1.0.0/docs/index-all.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/index-all.rst.txt +0 -0
- /crate-1.0.0/docs/other-options.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/other-options.rst.txt +0 -0
- /crate-1.0.0/docs/sqlalchemy.rst → /crate-1.0.0.dev1/docs/.crate-docs/.build/_sources/sqlalchemy.rst.txt +0 -0
- {crate-1.0.0/docs/_extra → crate-1.0.0.dev1/docs/.crate-docs/.build}/robots.txt +0 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/docs/requirements.txt +0 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate/client/_pep440.py +0 -0
- {crate-1.0.0 → crate-1.0.0.dev1}/src/crate.egg-info/dependency_links.txt +0 -0
- /crate-1.0.0/src/crate.egg-info/top_level.txt → /crate-1.0.0.dev1/src/crate.egg-info/namespace_packages.txt +0 -0
@@ -5,12 +5,6 @@ CrateDB Python developer guide
|
|
5
5
|
Setup
|
6
6
|
=====
|
7
7
|
|
8
|
-
Optionally install Python package and project manager ``uv``,
|
9
|
-
in order to significantly speed up the package installation::
|
10
|
-
|
11
|
-
{apt,brew,pip,zypper} install uv
|
12
|
-
alias pip="uv pip"
|
13
|
-
|
14
8
|
To start things off, bootstrap the sandbox environment::
|
15
9
|
|
16
10
|
git clone https://github.com/crate/crate-python
|
@@ -32,40 +26,34 @@ see, for example, `useful command-line options for zope-testrunner`_.
|
|
32
26
|
|
33
27
|
Run all tests::
|
34
28
|
|
35
|
-
|
29
|
+
./bin/test -vvvv
|
36
30
|
|
37
31
|
Run specific tests::
|
38
32
|
|
39
|
-
|
40
|
-
bin/test -t test_cursor
|
41
|
-
bin/test -t client
|
42
|
-
bin/test -t testing
|
43
|
-
|
44
|
-
# Select doctests.
|
45
|
-
bin/test -t http.rst
|
33
|
+
./bin/test -vvvv -t test_score
|
46
34
|
|
47
35
|
Ignore specific test directories::
|
48
36
|
|
49
|
-
bin/test --ignore_dir=testing
|
37
|
+
./bin/test -vvvv --ignore_dir=testing
|
50
38
|
|
51
39
|
The ``LayerTest`` test cases have quite some overhead. Omitting them will save
|
52
40
|
a few cycles (~70 seconds runtime)::
|
53
41
|
|
54
|
-
bin/test -t '!LayerTest'
|
42
|
+
./bin/test -t '!LayerTest'
|
55
43
|
|
56
|
-
Invoke all tests without integration tests (~
|
44
|
+
Invoke all tests without integration tests (~15 seconds runtime)::
|
57
45
|
|
58
|
-
bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest'
|
46
|
+
./bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest'
|
59
47
|
|
60
|
-
Yet ~
|
48
|
+
Yet ~130 test cases, but only ~5 seconds runtime::
|
61
49
|
|
62
|
-
bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest' \
|
50
|
+
./bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest' \
|
63
51
|
-t '!test_client_threaded' -t '!test_no_retry_on_read_timeout' \
|
64
52
|
-t '!test_wait_for_http' -t '!test_table_clustered_by'
|
65
53
|
|
66
54
|
To inspect the whole list of test cases, run::
|
67
55
|
|
68
|
-
bin/test --list-tests
|
56
|
+
./bin/test --list-tests
|
69
57
|
|
70
58
|
You can run the tests against multiple Python interpreters with `tox`_::
|
71
59
|
|
@@ -83,28 +71,11 @@ are listening on the default CrateDB transport port to avoid side effects with
|
|
83
71
|
the test layer.
|
84
72
|
|
85
73
|
|
86
|
-
Formatting and linting code
|
87
|
-
===========================
|
88
|
-
|
89
|
-
To use Ruff for code formatting, according to the standards configured in
|
90
|
-
``pyproject.toml``, use::
|
91
|
-
|
92
|
-
poe format
|
93
|
-
|
94
|
-
To lint the code base using Ruff and mypy, use::
|
95
|
-
|
96
|
-
poe lint
|
97
|
-
|
98
|
-
Linting and software testing, all together now::
|
99
|
-
|
100
|
-
poe check
|
101
|
-
|
102
|
-
|
103
74
|
Renew certificates
|
104
75
|
==================
|
105
76
|
|
106
77
|
For conducting TLS connectivity tests, there are a few X.509 certificates at
|
107
|
-
`
|
78
|
+
`src/crate/client/pki/*.pem`_. In order to renew them, follow the instructions
|
108
79
|
within the README file in this folder.
|
109
80
|
|
110
81
|
|
@@ -121,7 +92,7 @@ In the release branch:
|
|
121
92
|
|
122
93
|
- Update ``__version__`` in ``src/crate/client/__init__.py``
|
123
94
|
|
124
|
-
- Add a section for the new version in the ``CHANGES.
|
95
|
+
- Add a section for the new version in the ``CHANGES.txt`` file
|
125
96
|
|
126
97
|
- Commit your changes with a message like "prepare release x.y.z"
|
127
98
|
|
@@ -130,7 +101,7 @@ In the release branch:
|
|
130
101
|
- Create a tag by running ``./devtools/create_tag.sh``. This will trigger a
|
131
102
|
Github action which releases the new version to PyPi.
|
132
103
|
|
133
|
-
On
|
104
|
+
On master:
|
134
105
|
|
135
106
|
- Update the release notes to reflect the release
|
136
107
|
|
@@ -171,7 +142,7 @@ nothing special you need to do to get the live docs to update.
|
|
171
142
|
.. _Read the Docs: http://readthedocs.org
|
172
143
|
.. _ReStructuredText: http://docutils.sourceforge.net/rst.html
|
173
144
|
.. _Sphinx: http://sphinx-doc.org/
|
174
|
-
..
|
145
|
+
.. _src/crate/client/pki/*.pem: https://github.com/crate/crate-python/tree/master/src/crate/client/pki
|
175
146
|
.. _tox: http://testrun.org/tox/latest/
|
176
147
|
.. _twine: https://pypi.python.org/pypi/twine
|
177
148
|
.. _useful command-line options for zope-testrunner: https://pypi.org/project/zope.testrunner/#some-useful-command-line-options-to-get-you-started
|
@@ -176,3 +176,73 @@
|
|
176
176
|
of your accepting any such warranty or additional liability.
|
177
177
|
|
178
178
|
END OF TERMS AND CONDITIONS
|
179
|
+
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
181
|
+
|
182
|
+
To apply the Apache License to your work, attach the following
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
184
|
+
replaced with your own identifying information. (Don't include
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
186
|
+
comment syntax for the file format. We also recommend that a
|
187
|
+
file or class name and description of purpose be included on the
|
188
|
+
same "printed page" as the copyright notice for easier
|
189
|
+
identification within third-party archives.
|
190
|
+
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
192
|
+
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
194
|
+
you may not use this file except in compliance with the License.
|
195
|
+
You may obtain a copy of the License at
|
196
|
+
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
198
|
+
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
202
|
+
See the License for the specific language governing permissions and
|
203
|
+
limitations under the License.
|
204
|
+
|
205
|
+
|
206
|
+
===============================================================================
|
207
|
+
|
208
|
+
For the `docs` directory:
|
209
|
+
|
210
|
+
The source files for the documentation are licensed under the Apache License
|
211
|
+
Version 2.0. These source files are used by the project maintainers to build
|
212
|
+
online documentation for end-users:
|
213
|
+
|
214
|
+
<https://crate.io/docs/clients/python/en/latest/>
|
215
|
+
|
216
|
+
If you want to make contributions to the documentation, it may be necessary for
|
217
|
+
you to build the documentation yourself by following the instructions in the
|
218
|
+
`DEVELOP.rst` file. If you do this, a number of third-party software components
|
219
|
+
are necessary.
|
220
|
+
|
221
|
+
We do not ship the source code for these optional third-party software
|
222
|
+
components or their dependencies, so we cannot make any guarantees about the
|
223
|
+
licensing status of these components.
|
224
|
+
|
225
|
+
However, for convenience, the documentation build system explicitly references
|
226
|
+
the following software components (grouped by license):
|
227
|
+
|
228
|
+
PSF License:
|
229
|
+
|
230
|
+
- Python 3 <https://docs.python.org/3/license.html>
|
231
|
+
|
232
|
+
MIT License:
|
233
|
+
|
234
|
+
- pip <https://pypi.org/project/pip/>
|
235
|
+
- setuptools <https://pypi.org/project/setuptools/>
|
236
|
+
- sphinx-autobuild <https://pypi.org/project/sphinx-autobuild/>
|
237
|
+
|
238
|
+
BSD License:
|
239
|
+
|
240
|
+
- alabaster <https://pypi.org/project/alabaster/>
|
241
|
+
- sphinx <https://pypi.org/project/Sphinx/>
|
242
|
+
|
243
|
+
Apache License 2.0:
|
244
|
+
|
245
|
+
- crate-docs-theme <https://pypi.org/project/crate-docs-theme/>
|
246
|
+
|
247
|
+
Please note that each of these components may specify its own dependencies and
|
248
|
+
those dependencies may be licensed differently.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crate
|
3
|
-
Version: 1.0.0
|
3
|
+
Version: 1.0.0.dev1
|
4
4
|
Summary: CrateDB Python Client
|
5
5
|
Home-page: https://github.com/crate/crate-python
|
6
6
|
Author: Crate.io
|
@@ -21,32 +21,15 @@ Classifier: Programming Language :: Python :: 3.9
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.10
|
22
22
|
Classifier: Programming Language :: Python :: 3.11
|
23
23
|
Classifier: Programming Language :: Python :: 3.12
|
24
|
-
Classifier: Programming Language :: Python :: 3.13
|
25
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
26
25
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
27
26
|
Classifier: Topic :: Database
|
28
27
|
Requires-Python: >=3.6
|
29
28
|
Description-Content-Type: text/x-rst
|
29
|
+
Provides-Extra: test
|
30
|
+
Provides-Extra: doc
|
30
31
|
License-File: LICENSE
|
31
32
|
License-File: NOTICE
|
32
|
-
Requires-Dist: urllib3
|
33
|
-
Requires-Dist: verlib2
|
34
|
-
Provides-Extra: doc
|
35
|
-
Requires-Dist: crate-docs-theme>=0.26.5; extra == "doc"
|
36
|
-
Requires-Dist: sphinx<9,>=3.5; extra == "doc"
|
37
|
-
Provides-Extra: test
|
38
|
-
Requires-Dist: backports.zoneinfo<1; python_version < "3.9" and extra == "test"
|
39
|
-
Requires-Dist: certifi; extra == "test"
|
40
|
-
Requires-Dist: createcoverage<2,>=1; extra == "test"
|
41
|
-
Requires-Dist: mypy<1.14; extra == "test"
|
42
|
-
Requires-Dist: poethepoet<0.30; extra == "test"
|
43
|
-
Requires-Dist: ruff<0.8; extra == "test"
|
44
|
-
Requires-Dist: stopit<2,>=1.1.2; extra == "test"
|
45
|
-
Requires-Dist: tox<5,>=3; 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<7,>=5; extra == "test"
|
50
33
|
|
51
34
|
=====================
|
52
35
|
CrateDB Python Client
|
@@ -56,7 +39,7 @@ CrateDB Python Client
|
|
56
39
|
:target: https://github.com/crate/crate-python/actions?workflow=Tests
|
57
40
|
:alt: Build status
|
58
41
|
|
59
|
-
.. image:: https://codecov.io/gh/crate/crate-python/branch/
|
42
|
+
.. image:: https://codecov.io/gh/crate/crate-python/branch/master/graph/badge.svg
|
60
43
|
:target: https://app.codecov.io/gh/crate/crate-python
|
61
44
|
:alt: Coverage
|
62
45
|
|
@@ -152,3 +135,5 @@ GitHub`_. We appreciate contributions of any kind.
|
|
152
135
|
.. _sqlalchemy-cratedb documentation: https://cratedb.com/docs/sqlalchemy-cratedb/
|
153
136
|
.. _StackOverflow: https://stackoverflow.com/tags/cratedb
|
154
137
|
.. _support channels: https://cratedb.com/support/
|
138
|
+
|
139
|
+
|
@@ -6,7 +6,7 @@ CrateDB Python Client
|
|
6
6
|
:target: https://github.com/crate/crate-python/actions?workflow=Tests
|
7
7
|
:alt: Build status
|
8
8
|
|
9
|
-
.. image:: https://codecov.io/gh/crate/crate-python/branch/
|
9
|
+
.. image:: https://codecov.io/gh/crate/crate-python/branch/master/graph/badge.svg
|
10
10
|
:target: https://app.codecov.io/gh/crate/crate-python
|
11
11
|
:alt: Coverage
|
12
12
|
|
@@ -0,0 +1,158 @@
|
|
1
|
+
.. _data-types:
|
2
|
+
|
3
|
+
==========
|
4
|
+
Data types
|
5
|
+
==========
|
6
|
+
|
7
|
+
The :ref:`Database API client <connect>` and the :ref:`SQLAlchemy dialect
|
8
|
+
<using-sqlalchemy>` use different Python data types. Consult the corresponding
|
9
|
+
section for further information.
|
10
|
+
|
11
|
+
.. rubric:: Table of contents
|
12
|
+
|
13
|
+
.. contents::
|
14
|
+
:local:
|
15
|
+
|
16
|
+
.. _data-types-db-api:
|
17
|
+
|
18
|
+
Database API client
|
19
|
+
===================
|
20
|
+
|
21
|
+
This section documents data types for the CrateDB :ref:`Database API client
|
22
|
+
<connect>`.
|
23
|
+
|
24
|
+
.. CAUTION::
|
25
|
+
|
26
|
+
The CrateDB Database API client implementation is incomplete. For the time
|
27
|
+
being, the client uses native Python types.
|
28
|
+
|
29
|
+
In general, types are mapped as follows:
|
30
|
+
|
31
|
+
============= ===========
|
32
|
+
CrateDB Python
|
33
|
+
============= ===========
|
34
|
+
`boolean`__ `boolean`__
|
35
|
+
`string`__ `str`__
|
36
|
+
`int`__ `int`__
|
37
|
+
`long`__ `int`__
|
38
|
+
`short`__ `int`__
|
39
|
+
`double`__ `float`__
|
40
|
+
|
41
|
+
`float`__ `float`__
|
42
|
+
`byte`__ `int`__
|
43
|
+
`geo_point`__ `list`__
|
44
|
+
`geo_shape`__ `dict`__
|
45
|
+
`object`__ `dict`__
|
46
|
+
`array`__ `list`__
|
47
|
+
============= ===========
|
48
|
+
|
49
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#boolean
|
50
|
+
__ https://docs.python.org/3/library/stdtypes.html#boolean-values
|
51
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#character-data
|
52
|
+
__ https://docs.python.org/3/library/stdtypes.html#str
|
53
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
54
|
+
__ https://docs.python.org/3/library/functions.html#int
|
55
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
56
|
+
__ https://docs.python.org/3/library/functions.html#int
|
57
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
58
|
+
__ https://docs.python.org/3/library/functions.html#int
|
59
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
60
|
+
__ https://docs.python.org/3/library/functions.html#float
|
61
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
62
|
+
__ https://docs.python.org/3/library/functions.html#float
|
63
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
64
|
+
__ https://docs.python.org/3/library/functions.html#int
|
65
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#geo-point
|
66
|
+
__ https://docs.python.org/3/library/stdtypes.html#list
|
67
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#geo-shape
|
68
|
+
__ https://docs.python.org/3/library/stdtypes.html#dict
|
69
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#object
|
70
|
+
__ https://docs.python.org/3/library/stdtypes.html#dict
|
71
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#array
|
72
|
+
__ https://docs.python.org/3/library/stdtypes.html#list
|
73
|
+
|
74
|
+
When writing to CrateDB, the following conversions take place:
|
75
|
+
|
76
|
+
============= ====================================
|
77
|
+
Python CrateDB
|
78
|
+
============= ====================================
|
79
|
+
`Decimal`__ `string`__
|
80
|
+
`date`__ `integer`__, `long`__, or `string`__
|
81
|
+
`datetime`__ `integer`__, `long`__, or `string`__
|
82
|
+
============= ====================================
|
83
|
+
|
84
|
+
__ https://docs.python.org/3/library/decimal.html
|
85
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#character-data
|
86
|
+
__ https://docs.python.org/3/library/datetime.html#date-objects
|
87
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
88
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
89
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#character-data
|
90
|
+
__ https://docs.python.org/3/library/datetime.html#datetime-objects
|
91
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
92
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
93
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#character-data
|
94
|
+
|
95
|
+
.. NOTE::
|
96
|
+
|
97
|
+
The type that ``date`` and ``datetime`` objects are mapped depends on the
|
98
|
+
CrateDB column type.
|
99
|
+
|
100
|
+
.. _data-types-sqlalchemy:
|
101
|
+
|
102
|
+
SQLAlchemy
|
103
|
+
==========
|
104
|
+
|
105
|
+
This section documents data types for the CrateDB :ref:`SQLAlchemy dialect
|
106
|
+
<using-sqlalchemy>`.
|
107
|
+
|
108
|
+
.. _sqlalchemy-type-map:
|
109
|
+
|
110
|
+
Type map
|
111
|
+
--------
|
112
|
+
|
113
|
+
The CrateDB dialect maps between data types like so:
|
114
|
+
|
115
|
+
================= =========================================
|
116
|
+
CrateDB SQLAlchemy
|
117
|
+
================= =========================================
|
118
|
+
`boolean`__ `Boolean`__
|
119
|
+
`byte`__ `SmallInteger`__
|
120
|
+
`short`__ `SmallInteger`__
|
121
|
+
`integer`__ `Integer`__
|
122
|
+
`long`__ `NUMERIC`__
|
123
|
+
`float`__ `Float`__
|
124
|
+
`double`__ `DECIMAL`__
|
125
|
+
`timestamp`__ `TIMESTAMP`__
|
126
|
+
`string`__ `String`__
|
127
|
+
`array`__ `ARRAY`__
|
128
|
+
`object`__ :ref:`object` |nbsp| (extension type)
|
129
|
+
`array(object)`__ :ref:`objectarray` |nbsp| (extension type)
|
130
|
+
`geo_point`__ :ref:`geopoint` |nbsp| (extension type)
|
131
|
+
`geo_shape`__ :ref:`geoshape` |nbsp| (extension type)
|
132
|
+
================= =========================================
|
133
|
+
|
134
|
+
|
135
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#boolean
|
136
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.Boolean
|
137
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
138
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.SmallInteger
|
139
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
140
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.SmallInteger
|
141
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
142
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.Integer
|
143
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
144
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.NUMERIC
|
145
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
146
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.Float
|
147
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#numeric-data
|
148
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.DECIMAL
|
149
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#dates-and-times
|
150
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.TIMESTAMP
|
151
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#character-data
|
152
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.String
|
153
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#array
|
154
|
+
__ http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.ARRAY
|
155
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#object
|
156
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#array
|
157
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#geo-point
|
158
|
+
__ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#geo-shape
|
@@ -21,7 +21,7 @@ connect()
|
|
21
21
|
This section sets up a connection object, and inspects some of its attributes.
|
22
22
|
|
23
23
|
>>> from crate.client import connect
|
24
|
-
>>> from crate.
|
24
|
+
>>> from crate.client.test_util import ClientMocked
|
25
25
|
|
26
26
|
>>> connection = connect(client=ClientMocked())
|
27
27
|
>>> connection.lowest_server_version.version
|
@@ -23,7 +23,7 @@ up the response for subsequent cursor operations.
|
|
23
23
|
>>> from crate.client import connect
|
24
24
|
>>> from crate.client.converter import DefaultTypeConverter
|
25
25
|
>>> from crate.client.cursor import Cursor
|
26
|
-
>>> from crate.
|
26
|
+
>>> from crate.client.test_util import ClientMocked
|
27
27
|
|
28
28
|
>>> connection = connect(client=ClientMocked())
|
29
29
|
>>> cursor = connection.cursor()
|
@@ -333,7 +333,7 @@ types. Currently, this is implemented for the CrateDB data types ``IP`` and
|
|
333
333
|
>>> cursor.execute('')
|
334
334
|
|
335
335
|
>>> cursor.fetchone()
|
336
|
-
['foo', IPv4Address('10.10.10.1'), datetime.datetime(2022, 7, 18, 18, 10, 36, 758000
|
336
|
+
['foo', IPv4Address('10.10.10.1'), datetime.datetime(2022, 7, 18, 18, 10, 36, 758000)]
|
337
337
|
|
338
338
|
|
339
339
|
Custom data type conversion
|
@@ -374,7 +374,8 @@ Proof that the converter works correctly, ``B\'0110\'`` should be converted to
|
|
374
374
|
=======================================
|
375
375
|
|
376
376
|
Based on the data type converter functionality, the driver offers a convenient
|
377
|
-
interface to make it return ``datetime`` objects using the
|
377
|
+
interface to make it return timezone-aware ``datetime`` objects, using the
|
378
|
+
desired time zone.
|
378
379
|
|
379
380
|
For your reference, in the following examples, epoch 1658167836758 is
|
380
381
|
``Mon, 18 Jul 2022 18:10:36 GMT``.
|
@@ -42,7 +42,7 @@ When using a list of servers, the servers are selected by round-robin:
|
|
42
42
|
|
43
43
|
>>> invalid_host = "invalid_host:9999"
|
44
44
|
>>> even_more_invalid_host = "even_more_invalid_host:9999"
|
45
|
-
>>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host]
|
45
|
+
>>> http_client = HttpClient([crate_host, invalid_host, even_more_invalid_host])
|
46
46
|
>>> http_client._get_server()
|
47
47
|
'http://127.0.0.1:44209'
|
48
48
|
|
@@ -56,19 +56,17 @@ When using a list of servers, the servers are selected by round-robin:
|
|
56
56
|
|
57
57
|
Servers with connection errors will be removed from the active server list:
|
58
58
|
|
59
|
-
>>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host]
|
59
|
+
>>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host])
|
60
60
|
>>> result = http_client.sql('select name from locations')
|
61
61
|
>>> http_client._active_servers
|
62
62
|
['http://127.0.0.1:44209']
|
63
63
|
|
64
64
|
Inactive servers will be re-added after a given time interval.
|
65
|
-
To validate this, set the interval and
|
66
|
-
sleep after the first request::
|
65
|
+
To validate this, set the interval very short and sleep for that interval:
|
67
66
|
|
68
67
|
>>> http_client.retry_interval = 1
|
69
|
-
>>> result = http_client.sql('select name from locations')
|
70
68
|
>>> import time; time.sleep(1)
|
71
|
-
>>>
|
69
|
+
>>> result = http_client.sql('select name from locations')
|
72
70
|
>>> http_client._active_servers
|
73
71
|
['http://invalid_host:9999',
|
74
72
|
'http://even_more_invalid_host:9999',
|
@@ -78,7 +76,7 @@ sleep after the first request::
|
|
78
76
|
If no active servers are available and the retry interval is not reached, just use the oldest
|
79
77
|
inactive one:
|
80
78
|
|
81
|
-
>>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host]
|
79
|
+
>>> http_client = HttpClient([invalid_host, even_more_invalid_host, crate_host])
|
82
80
|
>>> result = http_client.sql('select name from locations')
|
83
81
|
>>> http_client._active_servers = []
|
84
82
|
>>> http_client._get_server()
|