Python Library for NoSQL database record versioning
Project description
A Python library for NoSQL record versioning.
Installation
To install the latest release on PyPi, simply run:
pip install nosql_versioning
Or to install the latest development version, run:
git clone https://github.com/xinhuang/nosql_versioning.git cd nosql_versioning python setup.py install
Quick Tutorial
>>> from nosql_versioning import database
>>>
>>> version, Record = database()
>>>
>>> @version()
>>> class Recordv0(object):
>>> def __init__(self, data):
>>> self.old_name = data['old_name']
>>>
>>> @version(1)
>>> class Recordv1(object):
>>> def __init__(self, data=None, value=None):
>>> if data:
>>> self.new_name = data['new_name']
>>> else:
>>> self.new_name = value
>>>
>>> @staticmethod
>>> def migrate(data):
>>> data['new_name'] = data['old_name']
>>> del data['old_name']
>>>
>>> rec = Record('{"_ver": 0, "old_name": 1}')
>>> print(rec.new_name)
1
>>> rec = Record(value=42) # custom constructor can also be used
>>> print(rec.new_name)
42
Licensing
This project is released under the terms of the MIT Open Source License. View LICENSE.txt for more information.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for nosql_versioning-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60de8dc484dad0de438e95e1369eda2318999ad41fe2a285b3653a512016ec27 |
|
MD5 | c40af310a541fa8b0b7f66f6bbee26ac |
|
BLAKE2b-256 | 13a58b4930f10aab69ac28adc12edae0bfab0595cb33a55b4b429d0d53a3732b |