Getting started

Learn how to install and get started with the Python client library for CrateDB.

Table of contents

Install

The CrateDB Python client is available as package crate on PyPI.

To install the most recent driver version, including the SQLAlchemy dialect extension, run:

pip install "crate[sqlalchemy]" --upgrade

After that is done, you can import the library, like so:

>>> from crate import client

Interactive use

Python provides a REPL, also known as an interactive language shell. It’s a handy way to experiment with code and try out new libraries. We recommend IPython, which you can install, like so:

pip install ipython

Once installed, you can start it up, like this:

ipython

From there, try importing the CrateDB Python client library and seeing how far you get with the built-in help() function (that can be called on any object), IPython’s autocompletion, and many other features.

Set up as a dependency

There are many ways to add the crate package as a dependency to your project. All of them work equally well. Please note that you may want to employ package version pinning in order to keep the environment of your project stable and reproducible, achieving repeatable installations.