Thanks to visit codestin.com
Credit goes to github.com

Skip to content

nmb10/rethinkdb-python

 
 

Repository files navigation

RethinkDB Python driver

Build Status Codacy Badge Codacy Badge

Overview

What is RethinkDB?

RethinkDB is the fork of RethinkDB which is the first open-source scalable database built for realtime applications. It exposes a new database access model -- instead of polling for changes, the developer can tell the database to continuously push updated query results to applications in realtime. RethinkDB allows developers to build scalable realtime apps in a fraction of the time with less effort.

Installation

$ pip install rethinkdb

Note: this package is the extracted driver of RethinkDB's original python driver.

Quickstart

The main difference with the previous driver (except the name of the package) is we are not importing RethinkDB as r. If you would like to use RethinkDB's python driver as a drop in replacement, you should do the following:

from rethinkdb import RethinkDB

r = RethinkDB()
connection = r.connect(db='test')

Example

Create a table, populate with data, and get every document.

from rethinkdb import RethinkDB

r = RethinkDB()
connection = r.connect(db='test')

r.table_create('marvel').run(connection)

marvel_heroes = r.table('marvel')
marvel_heroes.insert({
    'id': 1,
    'name': 'Iron Man',
    'first_appearance': 'Tales of Suspense #39'
}).run(connection)

for hero in marvel_heroes.run(connection):
    print(hero['name'])

Run tests

In the Makefile you can find three different test commands: test-unit, test-integration and test-remote. As RethinkDB has dropped the support of Windows, we would like to ensure that those of us who are using Windows for development can still contribute. Because of this, we support running integration tests against Digital Ocean Droplets as well.

Before you run any test, make sure that you install the requirements.

$ pip install -r requirements.txt

Running unit tests

$ make test-unit

Running integration tests

To run integration tests locally, make sure you intstalled RethinkDB

$ make test-integration

Running remote integration tests

To run the remote tests, you need to have a Digital Ocean account and an API key.

Remote test will create a new temporary SSH key and a Droplet for you until the tests are finished.

Available environment variables

Variable name Default value
DO_TOKEN N/A
DO_SIZE 512MB
DO_REGION sfo2
$ export DO_TOKEN=<YOUR_TOKEN>
$ make test-remote

New features

Github's Issue tracker is ONLY used for reporting bugs. NO NEW FEATURE ACCEPTED! Use spectrum for supporting features.

Contributing

Hurray! You reached this section which means, that you would like to contribute. Please read our contributing guide lines and feel free to open a pull request.

About

Python driver for RethinkDB

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.5%
  • Other 0.5%