This API allows users to use kv-service of the ResilientDB in Python directly.
- Make sure to run
./INSTALL.sh
in advance. - cd to
incubator-resilientdb/api
folder. - Run command
bazel build :pybind_kv_so
. - From
kv_operation.py
, importget_value
andset_value
functions into your Python file to use it (Make sure to use the same Python version when runningbazel build
command and calling the functions).
key
: The key user wants to store in a key-value pair. Acceptable types arestr
,int
,float
.value
: The corresponding value tokey
in the key-value pair. Acceptable types arestr
,int
,float
.- config_path (optional): The path to the user's blockchain config file (IP addresses). If the user does not specify this parameter, the system will default to the address located in "ip.address.config." The acceptable type is
str
. return
:True
ifvalue
has been set successfully; otherwise,value
has not been set successfully.
key
: The key user wants to get in a key-value pair. Acceptable types arestr
,int
,float
.return
:\n
if the corresponding value ofkey
is empty, otherwise is the corresponding value ofkey
.
import sys
# Your path to ResilientDB api folder
sys.path.append("/home/ubuntu/Desktop/incubator-resilientdb/api")
from kv_operation import set_value, get_value
set_value("test", "111222")
get_value("test")
If having set up the environment parameter, "sys.path" can be ignorred.
export PYTHON_PATH="/home/ubuntu/Desktop/incubator-resilientdb/api":PYTHON_PATH
from kv_operation import set_value, get_value
set_value("test", "111222")
get_value("test")