@@ -11,12 +11,13 @@ SQLAlchemy dialect for CrateDB
11
11
:depth: 1
12
12
13
13
14
- ************
15
- Introduction
16
- ************
14
+ *****
15
+ About
16
+ *****
17
17
18
18
The :ref: `CrateDB dialect <using-sqlalchemy >` for `SQLAlchemy `_ provides adapters
19
19
for `CrateDB `_ and SQLAlchemy. The supported versions are 1.3, 1.4, and 2.0.
20
+ The package is available from `PyPI `_ at `sqlalchemy-cratedb `_.
20
21
21
22
The connector can be used to connect to both `CrateDB `_ and `CrateDB
22
23
Cloud `_, and is verified to work on Linux, macOS, and Windows. It is used by
@@ -25,29 +26,40 @@ CrateDB from the Python ecosystem. It is verified to work with CPython, but
25
26
it has also been tested successfully with `PyPy `_.
26
27
27
28
28
- *************
29
- Documentation
30
- *************
29
+ ************
30
+ Introduction
31
+ ************
31
32
32
33
Please consult the `SQLAlchemy tutorial `_, and the general `SQLAlchemy
33
34
documentation `_.
34
- For more detailed information about how to install the client driver , how to
35
+ For more detailed information about how to install the dialect package , how to
35
36
connect to a CrateDB cluster, and how to run queries, consult the resources
36
37
referenced below.
37
38
39
+
40
+ ************
41
+ Installation
42
+ ************
43
+
44
+ Install package from PyPI.
45
+
46
+ .. code-block :: shell
47
+
48
+ pip install --upgrade sqlalchemy-cratedb
49
+
50
+ More installation details can be found over here.
51
+
38
52
.. toctree ::
39
53
:titlesonly:
40
54
41
55
install
42
56
43
- SQLAlchemy
44
- ==========
45
57
46
- Install package from PyPI.
58
+ .. _ features :
47
59
48
- .. code-block :: shell
49
-
50
- pip install sqlalchemy-cratedb
60
+ ********
61
+ Features
62
+ ********
51
63
52
64
The CrateDB dialect for `SQLAlchemy `_ offers convenient ORM access and supports
53
65
CrateDB's container data types ``OBJECT `` and ``ARRAY ``, its vector data type
@@ -59,23 +71,20 @@ kinds of `GeoJSON geometry objects`_.
59
71
60
72
overview
61
73
62
- Install package from PyPI with DB API and SQLAlchemy support.
63
74
64
- .. code-block :: shell
75
+ .. _ synopsis :
65
76
66
- pip install sqlalchemy-cratedb pandas
77
+ Synopsis
78
+ ========
67
79
68
80
Connect to CrateDB instance running on ``localhost ``.
69
81
70
82
.. code-block :: python
71
83
72
84
# Connect using SQLAlchemy Core.
73
- import pkg_resources
74
85
import sqlalchemy as sa
75
86
from pprint import pp
76
87
77
- pkg_resources.require(" sqlalchemy>=2.0" )
78
-
79
88
dburi = " crate://localhost:4200"
80
89
query = " SELECT country, mountain, coordinates, height FROM sys.summits ORDER BY country;"
81
90
@@ -95,6 +104,10 @@ Connect to `CrateDB Cloud`_.
95
104
96
105
Load results into `pandas `_ DataFrame.
97
106
107
+ .. code-block :: shell
108
+
109
+ pip install pandas
110
+
98
111
.. code-block :: python
99
112
100
113
# Connect using SQLAlchemy Core and pandas.
@@ -114,13 +127,15 @@ Load results into `pandas`_ DataFrame.
114
127
Data types
115
128
==========
116
129
117
- The DB API driver and the SQLAlchemy dialect support :ref: `CrateDB's data types
118
- <crate-reference:data-types>` to different degrees. For more information,
119
- please consult the :ref: `data-types ` and :ref: `SQLAlchemy extension types
120
- <using-extension-types>` documentation pages.
130
+ The :ref: `DB API driver <crate-python:index >` and the SQLAlchemy dialect
131
+ support :ref: `CrateDB's data types <crate-reference:data-types >` to different
132
+ degrees.
133
+ For more information, please consult the :ref: `data-types ` and :ref: `SQLAlchemy
134
+ extension types <using-extension-types>` documentation pages.
121
135
122
136
.. toctree ::
123
137
:maxdepth: 2
138
+ :hidden:
124
139
125
140
data-types
126
141
@@ -129,8 +144,9 @@ please consult the :ref:`data-types` and :ref:`SQLAlchemy extension types
129
144
.. _by-example :
130
145
.. _sqlalchemy-by-example :
131
146
147
+ ********
132
148
Examples
133
- ========
149
+ ********
134
150
135
151
This section enumerates concise examples demonstrating the
136
152
use of the SQLAlchemy dialect.
@@ -145,15 +161,12 @@ use of the SQLAlchemy dialect.
145
161
inspection-reflection
146
162
dataframe
147
163
164
+ .. rubric :: See also
148
165
149
- See also
150
- --------
151
166
- Executable code examples are maintained within the `cratedb-examples repository `_.
152
- - The `sample application `_ and the corresponding `sample application
153
- documentation `_ demonstrate the use of the driver on behalf of an example
154
- "guestbook" application.
155
- - `Use CrateDB with pandas `_ has corresponding code snippets about how to
156
- connect to CrateDB using `pandas `_, and how to load and export data.
167
+ - `Using CrateDB with pandas, Dask, and Polars `_ has corresponding code snippets
168
+ about how to connect to CrateDB using popular data frame libraries, and how to
169
+ load and export data.
157
170
- The `Apache Superset `_ and `FIWARE QuantumLeap data historian `_ projects.
158
171
159
172
@@ -164,13 +177,13 @@ Project information
164
177
165
178
Resources
166
179
=========
167
- - `Source code <https://github.com/crate/crate-python >`_
168
- - `Documentation <https://crate.io/docs/python/ >`_
169
- - `Python Package Index (PyPI) <https://pypi.org/project/crate / >`_
180
+ - `Source code <https://github.com/crate-workbench/sqlalchemy-cratedb >`_
181
+ - `Documentation <https://github.com/crate-workbench/sqlalchemy-cratedb >`_
182
+ - `Python Package Index (PyPI) <https://pypi.org/project/sqlalchemy-cratedb / >`_
170
183
171
184
Contributions
172
185
=============
173
- The CrateDB Python client library is an open source project, and is `managed on
186
+ The SQLAlchemy dialect for CrateDB is an open source project, and is `managed on
174
187
GitHub `_.
175
188
Every kind of contribution, feedback, or patch, is much welcome. `Create an
176
189
issue `_ or submit a patch if you think we should include a new feature, or to
@@ -193,24 +206,23 @@ The project is licensed under the terms of the Apache 2.0 license, like
193
206
194
207
195
208
.. _Apache Superset : https://github.com/apache/superset
196
- .. _Crash CLI : https://crate.io/docs/crate/crash/
197
209
.. _CrateDB : https://crate.io/products/cratedb
198
210
.. _CrateDB Cloud : https://console.cratedb.cloud/
199
211
.. _CrateDB source : https://github.com/crate/crate
200
- .. _Create an issue : https://github.com/crate/crate-python /issues
201
- .. _development sandbox : https://github.com/crate/crate-python /blob/master /DEVELOP.rst
212
+ .. _Create an issue : https://github.com/crate-workbench/sqlalchemy-cratedb /issues
213
+ .. _development sandbox : https://github.com/crate-workbench/sqlalchemy-cratedb /blob/main /DEVELOP.md
202
214
.. _cratedb-examples repository : https://github.com/crate/cratedb-examples/tree/main/by-language
203
215
.. _FIWARE QuantumLeap data historian : https://github.com/orchestracities/ngsi-timeseries-api
204
216
.. _GeoJSON : https://geojson.org/
205
217
.. _GeoJSON geometry objects : https://tools.ietf.org/html/rfc7946#section-3.1
206
- .. _LICENSE : https://github.com/crate/crate-python /blob/master /LICENSE
207
- .. _managed on GitHub : https://github.com/crate/crate-python
218
+ .. _LICENSE : https://github.com/crate-workbench/sqlalchemy-cratedb /blob/main /LICENSE
219
+ .. _managed on GitHub : https://github.com/crate-workbench/sqlalchemy-cratedb
208
220
.. _pandas : https://pandas.pydata.org/
209
221
.. _PEP 249 : https://peps.python.org/pep-0249/
222
+ .. _PyPI : https://pypi.org/
210
223
.. _PyPy : https://www.pypy.org/
211
- .. _sample application : https://github.com/crate/crate-sample-apps/tree/main/python-flask
212
- .. _sample application documentation : https://github.com/crate/crate-sample-apps/blob/main/python-flask/documentation.md
213
224
.. _SQLAlchemy : https://www.sqlalchemy.org/
214
225
.. _SQLAlchemy documentation : https://docs.sqlalchemy.org/
215
226
.. _SQLAlchemy tutorial : https://docs.sqlalchemy.org/en/latest/tutorial/
216
- .. _Use CrateDB with pandas : https://github.com/crate/crate-qa/pull/246
227
+ .. _sqlalchemy-cratedb : https://pypi.org/project/sqlalchemy-cratedb/
228
+ .. _Using CrateDB with pandas, Dask, and Polars : https://github.com/crate/cratedb-examples/tree/main/by-dataframe
0 commit comments