spddb¶
Spddb is a simple python dictionary key-value based database, spddb support logging handler wich allow you log insert and delete operation into a logfile each operation are timestamped
Installation guide¶
The recommended (and easiest) way to install spddb:
$ git clone https://github.com/spddb/spddb
$ cd spddb
$ python setup.py install
Commannds¶
$ insert <key> <value> → Add specified key value
$ get <key> → Return the value of the specified key
$ getkeys → Return the database keys
$ delete <key> → Delete specified key
$ have <key> → Return True if the key exists False if not
$ getsize → Return the database size in bytes
Usage guide¶
Look how easy it is to use:
>>> from spddb import ziverdb
>>> db = ziverdb("test.db")
>>> db.insert("hello", "world")
>>> db.have("hello")
>>> True
>>> db.get("hello")
>>> "world"
>>> db.getsize()
>>> 18
>>> db.getkeys()
>>> ['hello']
>>>
>>> db.delete("hello")
>>> db.have("hello")
>>> False
Using Logging¶
Using spddb you can log insert and remove operations
>>> from spddb import ziverdb
>>> db = ziverdb("test.db")
>>> db.logfile = "test.log"
>>> db.insert("hello", "world")
>>> db.delete("hello")
$ cat test.log
$ 2017-12-29 23:37:06,685 Added key hello with value world
$ 2017-12-29 23:37:06,686 Deleted key hello