Atomic transactions for TinyDB
Project description
TinyDB __ _ __ / /_(_)__ __ _________ _______ _______/ / / __/ / _ \/ // / __/ -_) __/ _ \/ __/ _ / \__/_/_//_/\_, /_/ \__/\__/\___/_/ \_,_/ /___/
Supported Pythons: 2.6+, 3.2+
Tinyrecord is a library which implements experimental atomic transaction support for the TinyDB NoSQL database. It uses a record-first then execute architecture which allows us to minimize the time that we are within a thread lock. Usage example:
from tinydb import TinyDB, where
from tinyrecord import transaction
table = TinyDB('db.json').table('table')
with transaction(table) as tr:
tr.insert({})
tr.update({'x': 'a'}, where('x') == 'z')
tr.remove(where('x') == 'y')
Note that due to performance reasons you cannot view the data within a transaction unless you’ve comitted. You will have to call operations on the transaction object and not the database itself. Since tinyrecord works with dictionaries and the latest API, it will only support the dev version (2.0).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tinyrecord-0.1.0.tar.gz
(3.2 kB
view hashes)