Skip to content

Commit 74324f2

Browse files
committed
Documentation: Add/reactivate documentation as sqlalchemy-cratedb
1 parent 696491c commit 74324f2

File tree

14 files changed

+103
-74
lines changed

14 files changed

+103
-74
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
*.pyc
77
.coverage
88
coverage.xml
9-
dist/
9+
/build
10+
/dist

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
## Unreleased
5+
- Added/reactivated documentation as `sqlalchemy-cratedb`
56

67
## 2024/06/13 0.37.0
78
- Added support for CrateDB's [FLOAT_VECTOR] data type and its accompanying

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ pip install --upgrade sqlalchemy-cratedb
2626

2727
## Documentation and help
2828

29-
- [CrateDB Python Client documentation](https://crate.io/docs/python/)
30-
- [CrateDB reference documentation](https://crate.io/docs/reference/)
29+
- [SQLAlchemy dialect for CrateDB](https://cratedb.com/docs/sqlalchemy-cratedb/)
30+
- [CrateDB Python Client documentation](https://cratedb.com/docs/python/)
31+
- [CrateDB reference documentation](https://cratedb.com/docs/reference/)
3132
- [Developer documentation](DEVELOP.md)
3233
- [Contributing](CONTRIBUTING.md)
33-
- Other [support channels](https://crate.io/support/)
34+
- Other [support channels](https://cratedb.com/support)
3435

3536
## Contributing
3637

bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Bootstrap sandbox environment for crate-python
3+
# Bootstrap sandbox environment for sqlalchemy-cratedb
44
#
55
# - Create a Python virtualenv
66
# - Install all dependency packages and modules

docs/advanced-querying.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Using the ``group_by`` clause is similar:
205205

206206
In SQLAlchemy, the ``insert().from_select()`` function returns a new ``Insert``
207207
construct, which represents an ``INSERT...FROM SELECT`` statement. This
208-
functionality is supported by the CrateDB client library. Here is an example
208+
functionality is supported by the SQLAlchemy CrateDB dialect. Here is an example
209209
that uses ``insert().from_select()``.
210210

211211
First, let's define and create the tables:

docs/build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"schemaVersion": 1,
33
"label": "docs build",
4-
"message": "2.1.1"
4+
"message": "2.1.2"
55
}

docs/conf.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
from crate.theme.rtd.conf.python import *
2-
3-
4-
if "sphinx.ext.intersphinx" not in extensions:
5-
extensions += ["sphinx.ext.intersphinx"]
1+
from crate.theme.rtd.conf.sqlalchemy_cratedb import *
62

73

84
if "intersphinx_mapping" not in globals():
@@ -12,7 +8,6 @@
128
intersphinx_mapping.update({
139
'py': ('https://docs.python.org/3/', None),
1410
'sa': ('https://docs.sqlalchemy.org/en/20/', None),
15-
'urllib3': ('https://urllib3.readthedocs.io/en/1.26.13/', None),
1611
'dask': ('https://docs.dask.org/en/stable/', None),
1712
'pandas': ('https://pandas.pydata.org/docs/', None),
1813
})

docs/index-all.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:orphan:
2+
3+
.. _index-all:
4+
5+
#######################################
6+
CrateDB SQLAlchemy dialect -- all pages
7+
#######################################
8+
9+
10+
.. rubric:: Table of contents
11+
12+
.. toctree::
13+
:maxdepth: 2
14+
15+
getting-started
16+
crud
17+
working-with-types
18+
advanced-querying
19+
inspection-reflection
20+
dataframe

docs/index.rst

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ SQLAlchemy dialect for CrateDB
1111
:depth: 1
1212

1313

14-
************
15-
Introduction
16-
************
14+
*****
15+
About
16+
*****
1717

1818
The :ref:`CrateDB dialect <using-sqlalchemy>` for `SQLAlchemy`_ provides adapters
1919
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`_.
2021

2122
The connector can be used to connect to both `CrateDB`_ and `CrateDB
2223
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
2526
it has also been tested successfully with `PyPy`_.
2627

2728

28-
*************
29-
Documentation
30-
*************
29+
************
30+
Introduction
31+
************
3132

3233
Please consult the `SQLAlchemy tutorial`_, and the general `SQLAlchemy
3334
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
3536
connect to a CrateDB cluster, and how to run queries, consult the resources
3637
referenced below.
3738

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+
3852
.. toctree::
3953
:titlesonly:
4054

4155
install
4256

43-
SQLAlchemy
44-
==========
4557

46-
Install package from PyPI.
58+
.. _features:
4759

48-
.. code-block:: shell
49-
50-
pip install sqlalchemy-cratedb
60+
********
61+
Features
62+
********
5163

5264
The CrateDB dialect for `SQLAlchemy`_ offers convenient ORM access and supports
5365
CrateDB's container data types ``OBJECT`` and ``ARRAY``, its vector data type
@@ -59,23 +71,20 @@ kinds of `GeoJSON geometry objects`_.
5971

6072
overview
6173

62-
Install package from PyPI with DB API and SQLAlchemy support.
6374

64-
.. code-block:: shell
75+
.. _synopsis:
6576

66-
pip install sqlalchemy-cratedb pandas
77+
Synopsis
78+
========
6779

6880
Connect to CrateDB instance running on ``localhost``.
6981

7082
.. code-block:: python
7183
7284
# Connect using SQLAlchemy Core.
73-
import pkg_resources
7485
import sqlalchemy as sa
7586
from pprint import pp
7687
77-
pkg_resources.require("sqlalchemy>=2.0")
78-
7988
dburi = "crate://localhost:4200"
8089
query = "SELECT country, mountain, coordinates, height FROM sys.summits ORDER BY country;"
8190
@@ -95,6 +104,10 @@ Connect to `CrateDB Cloud`_.
95104
96105
Load results into `pandas`_ DataFrame.
97106

107+
.. code-block:: shell
108+
109+
pip install pandas
110+
98111
.. code-block:: python
99112
100113
# Connect using SQLAlchemy Core and pandas.
@@ -114,13 +127,15 @@ Load results into `pandas`_ DataFrame.
114127
Data types
115128
==========
116129

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.
121135

122136
.. toctree::
123137
:maxdepth: 2
138+
:hidden:
124139

125140
data-types
126141

@@ -129,8 +144,9 @@ please consult the :ref:`data-types` and :ref:`SQLAlchemy extension types
129144
.. _by-example:
130145
.. _sqlalchemy-by-example:
131146

147+
********
132148
Examples
133-
========
149+
********
134150

135151
This section enumerates concise examples demonstrating the
136152
use of the SQLAlchemy dialect.
@@ -145,15 +161,12 @@ use of the SQLAlchemy dialect.
145161
inspection-reflection
146162
dataframe
147163

164+
.. rubric:: See also
148165

149-
See also
150-
--------
151166
- 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.
157170
- The `Apache Superset`_ and `FIWARE QuantumLeap data historian`_ projects.
158171

159172

@@ -164,13 +177,13 @@ Project information
164177

165178
Resources
166179
=========
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/>`_
170183

171184
Contributions
172185
=============
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
174187
GitHub`_.
175188
Every kind of contribution, feedback, or patch, is much welcome. `Create an
176189
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
193206

194207

195208
.. _Apache Superset: https://github.com/apache/superset
196-
.. _Crash CLI: https://crate.io/docs/crate/crash/
197209
.. _CrateDB: https://crate.io/products/cratedb
198210
.. _CrateDB Cloud: https://console.cratedb.cloud/
199211
.. _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
202214
.. _cratedb-examples repository: https://github.com/crate/cratedb-examples/tree/main/by-language
203215
.. _FIWARE QuantumLeap data historian: https://github.com/orchestracities/ngsi-timeseries-api
204216
.. _GeoJSON: https://geojson.org/
205217
.. _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
208220
.. _pandas: https://pandas.pydata.org/
209221
.. _PEP 249: https://peps.python.org/pep-0249/
222+
.. _PyPI: https://pypi.org/
210223
.. _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
213224
.. _SQLAlchemy: https://www.sqlalchemy.org/
214225
.. _SQLAlchemy documentation: https://docs.sqlalchemy.org/
215226
.. _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

docs/install.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Install
55
=======
66

7-
Learn how to install and get started with the Python client library for
8-
`CrateDB`_.
7+
Learn how to install and get started with the SQLAlchemy dialect for
8+
`CrateDB`_. The package is available from `PyPI`_ at `sqlalchemy-cratedb`_.
99

1010
.. rubric:: Table of contents
1111

@@ -15,12 +15,10 @@ Learn how to install and get started with the Python client library for
1515
Install
1616
=======
1717

18-
.. highlight:: sh
19-
20-
The CrateDB Python client is available as package ``sqlalchemy-cratedb`` on `PyPI`_.
21-
2218
To install the most recent driver version, including the SQLAlchemy dialect
23-
extension, run::
19+
extension, run:
20+
21+
.. code-block:: shell
2422
2523
pip install --upgrade sqlalchemy-cratedb
2624
@@ -42,11 +40,11 @@ and reproducible, achieving `repeatable installations`_.
4240
Next steps
4341
==========
4442

45-
Learn how to :ref:`connect to CrateDB <connect>`.
43+
Learn how to :ref:`get started <getting-started>`, or how to :ref:`connect to CrateDB <connect>`.
4644

4745

48-
.. _sqlalchemy-cratedb: https://pypi.org/project/sqlalchemy-cratedb/
49-
.. _CrateDB: https://crate.io/products/cratedb/
46+
.. _CrateDB: https://cratedb.com/database
5047
.. _many ways: https://packaging.python.org/key_projects/
5148
.. _PyPI: https://pypi.org/
5249
.. _repeatable installations: https://pip.pypa.io/en/latest/topics/repeatable-installs/
50+
.. _sqlalchemy-cratedb: https://pypi.org/project/sqlalchemy-cratedb/

0 commit comments

Comments
 (0)