Skip to content

Commit

Permalink
import and merge install and first use info from getting started docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Naomi Slater committed Feb 21, 2018
1 parent e23167b commit 580dbdf
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/develop-eggs/
/dist
/eggs
/out
out/
/parts/
crate.egg-info
htmlcov/
14 changes: 14 additions & 0 deletions docs/index.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
.. _index:

=====================
CrateDB Python Client
=====================

A Python client library for `CrateDB`_.

This library:

- Implements the Python `DB API 2.0`_ specification
- Includes support for `SQLAlchemy`_ (>= 1.0.0)

.. rubric:: Table of Contents

.. toctree::
:maxdepth: 2

install-first-use.txt
client.txt
sqlalchemy.txt
blobs.txt
advanced_usage.txt
https.txt

.. _CrateDB: https://crate.io/products/cratedb/
.. _DB API 2.0: http://www.python.org/dev/peps/pep-0249/
.. _SQLAlchemy: http://www.sqlalchemy.org/
70 changes: 70 additions & 0 deletions docs/install-first-use.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
=====================
Install and First Use
=====================

This page shows you how to install the :ref:`Python client library for
CrateDB <index>` and then walks you through a simple first use scenario.

Prerequisites
=============

Recent versions of this library require Python 3 (>= 3.4) to run.

Use version 0.21.x if you are running Python 2.7/3.3 or version 0.14.x if you
are running Python 2.6.

Install
=======

The CrateDB Python client is available as a `pip`_ package.

To install, run:

.. code-block:: sh

sh$ pip install crate

To update, run:

.. code-block:: sh

sh$ pip install -U crate

If you use Python 2.7 or 3.3 with a recent version of pip, it will install only
version 0.21.x by default, because newer versions of this package are not
compatible with Python 2.7/3.3 any more.

Connect to CrateDB
==================

Import the client module from the ``crate`` package:

.. code-block:: python

from crate import client

Use the ``client`` module to create a connection:

.. code-block:: python

connection = client.connect(SERVER_IP)

Open a cursor to the database to enable queries.

.. code-block:: python

cursor = connection.cursor()

Learning More
=============

Crate.io maintains a `sample Python application`_ that uses this library, which
may be a good starting point as you learn to use it for the first time. And be
sure to check out out the `application documentation`_.

Browse the rest of the Python client :ref:`reference documentation <index>` for
more information.

.. _sample Python application: https://github.com/crate/crate-sample-apps/tree/master/python
.. _application documentation: https://github.com/crate/crate-sample-apps/blob/master/python/documentation.md
.. _pip: https://pypi.python.org/pypi/pip

0 comments on commit 580dbdf

Please # to comment.