Installing the Python driver

Before you install a driver: install RethinkDB first.

Looking for another language? See the complete list of client drivers for RethinkDB.

Installation

From version 1.14, the Python driver for RethinkDB supports Python 2 and 3. Version 1.13 and older support Python 2 only.

Install the driver with pip:

$ sudo pip install rethinkdb

Usage

You can use the drivers from Python like this:

$ python
import rethinkdb as r
r.connect('localhost', 28015).repl()
r.db('test').table_create('tv_shows').run()
r.table('tv_shows').insert({ 'name': 'Star Trek TNG' }).run()

Note: RethinkDB connection objects are not thread-safe. It’s recommended that applications open a separate connection per thread, or establish a connection pool.

The RethinkDB Python driver includes support for asynchronous connections using both Tornado and Twisted. Read the asynchronous connections documentation for more information.

Next steps

Move on to the ten-minute guide and learn how to use RethinkDB.