pyBluzelle is a python client for developing Python applications that can connect to Bluzelle SwarmDB and performs all standard CRUD operations. It is built on top of WebSocket API.
-
Install Python 3.6
-
Follow the instruction of deploying SwarmDB on Docker: https://github.com/bluzelle/swarmDB
-
Get our client code (https://github.com/weininghu1012/pyBluzelle)
-
Run
python3 setup.py install
under thepyBluzelle
directory
-
Run
python3
in your terminal -
Run
import pyBluzelle
-
Run
my_connection = pyBluzelle.create_connection(localhostIP, port, UUID)
-
Ready for test
-
Try it in the python interpreter
>>> import pyBluzelle
>>> b = pyBluzelle.create_connection("127.0.0.1", 51011, "137a8403-52ec-43b7-8083-91391d4c5e67")
>>> b.create("kk","1234")
True
>>> b.read("kk")
'1234'
run python3 test/test_create.py
in the pyBluzelle
directory
create an key value pair, return false if the key exists, return true if success.
create(key, value)
update the key with the value, return false if the key does not exist, return true if success.
update(key, value)
return the value of the key, return None if key does not exist.
read(key)
delete key, return false if the key does not exist, return true if success.
delete(key)
return false if the key does not exist, return true if success.
has(key)
return the list of the keys in the DB
keys()