Skip to content

Commit

Permalink
Python: Add section about sqlalchemy-cratedb
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 13, 2024
1 parent e1c8eda commit 25d4f8b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/connect/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ crate-python
The ``crate`` Python package offers a database client implementation compatible
with the Python Database API 2.0 specification, and also includes the CrateDB
SQLAlchemy dialect. See the full documentation :ref:`here <crate-python:index>`.
The package can be installed using ``pip install crate[sqlalchemy]``.
The package can be installed using ``pip install crate``.

.. code-block:: python
Expand All @@ -30,6 +30,27 @@ The package can be installed using ``pip install crate[sqlalchemy]``.
result = cursor.fetchone()
print(result)
.. _sqlalchemy-cratedb:

sqlalchemy-cratedb
------------------

The `SQLAlchemy`_ dialect for CrateDB, based on the HTTP-based DBAPI client
library `crate-python`_.
See the full documentation :ref:`here <sqlalchemy-cratedb:index>`.
The package can be installed using ``pip install sqlalchemy-cratedb``.

.. code-block:: python
import sqlalchemy as sa
engine = sa.create_engine("crate://localhost:4200", echo=True)
connection = engine.connect()
result = connection.execute(sa.text("SELECT * FROM sys.summits;"))
for record in result.all():
print(record)
.. _psycopg2:

psycopg2
Expand Down Expand Up @@ -139,3 +160,4 @@ For more information, see the `asyncpg documentation`_.
.. _asyncpg documentation: https://magicstack.github.io/asyncpg/current/
.. _psycopg documentation: https://www.psycopg.org/docs/
.. _Psycopg 3: https://www.psycopg.org/psycopg3/docs/
.. _SQLAlchemy: https://www.sqlalchemy.org/

0 comments on commit 25d4f8b

Please sign in to comment.