Skip to main content
https://travis-ci.org/internetarchive/doublethink.svg?branch=master

doublethink

RethinkDB python library. Provides connection manager and ORM framework (object-relational mapping, sometimes called ODM or OM for nosql databases).

Connection Manager

Three main purposes:

  • round-robin connections among database servers

  • make sure connections close at proper time

  • retry retry-able queries on failure

Not currently a connection pool, because it doesn’t keep any connections open. Should be possible to implement connection pooling without changing the API. However, testing suggests there would be no appreciable performance gain from connection pooling.

Usage Example

import doublethink
rr = doublethink.Rethinker(['db0.foo.com', 'db0.foo.com:38015', 'db1.foo.com'], 'my_db')
rr.table('mytable').insert({'foo':'bar','baz':2}).run()
for result in rr.table('mytable'):
    print("result={}".format(result))

ORM

Simple yet powerful ORM system. Does not enforce a schema.

Usage Example

import doublethink

rr = doublethink.Rethinker(['db0.foo.com', 'db0.foo.com:38015', 'db1.foo.com'], 'my_db')

class MyTable(doublethink.Document):
    pass
MyTable.table_create(rr)

doc1 = MyTable(rr, {'animal': 'elephant', 'size': 'large'})
doc1.save()

doc1_copy = MyTable.load(rr, doc1.id)
doc1_copy.food = 'bread'
doc1_copy.save()

doc1.first_name = 'Frankworth'
doc1.save()

doc1.refresh()

Service Registry

Now also has a ServiceRegistry class, a lightweight solution for service discovery for distributed services. Maintains service info and status in a rethinkdb table called “services”.

Metadata

Release files for doublethink 0.4.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doublethink 0.4.10
File Size Uploaded
doublethink-0.4.10.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doublethink 0.4.10
File Interpreter ABI Platform
doublethink-0.4.10-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / doublethink-0.4.10.tar.gz

Download URL doublethink-0.4.10.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f2bb6c7aa4bbb24ea275caa40eb0ca1a9a4f3bdfb1c24f72a9697a9747eeb903
BLAKE2b-256 checksum
How to use checksums
d1a82dfe88cb487f756e26fcc3345d0358abcfbc416c36f2dcbbbf5a80e9a8b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / doublethink-0.4.10-py3-none-any.whl

Download URL doublethink-0.4.10-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a72cfb09420dd5e671d874ab2cda4785347af1defb311118079621776bfedc8
BLAKE2b-256 checksum
How to use checksums
860297a30ace6d26615d544f8b40f2801907f9d9b5c6a35dff8ca54c2b44490c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page