rethinkdb python library
Project description
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”.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file doublethink-0.4.9.tar.gz
.
File metadata
- Download URL: doublethink-0.4.9.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ecdfbe774ca2d327ffd3b81c32f1d6ec62a481458147f3eca0817efef7518ac |
|
MD5 | bae808dfc7d9051581ccd90e22145f1f |
|
BLAKE2b-256 | 7dedcd8db797bd70f0a6471366bdd8d0f7132d288dcaca9bd476e2df3cc45e19 |
File details
Details for the file doublethink-0.4.9-py3-none-any.whl
.
File metadata
- Download URL: doublethink-0.4.9-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 890ef75f11ff9ef6e5d93d7b88d34a58372f0568dcc17afc7450d03ffd7f630d |
|
MD5 | cfe5d505b1cfc98d369ed00ef25985b2 |
|
BLAKE2b-256 | 7c587a159d2404f3c0eb167a08532d3e1adc7396b4d78c7c8c5cb5957e6b6379 |