This API allows users to use kv-service of the ResilientDB in Python directly.
./INSTALL.sh in advance.incubator-resilientdb/api folder.bazel build :pybind_kv_so.kv_operation.py, import get_value and set_value functions into your Python file to use it (Make sure to use the same Python version when running bazel build command and calling the functions).set_value:key: The key user wants to store in a key-value pair. Acceptable types are str, int, float.value: The corresponding value to key in the key-value pair. Acceptable types are str, int, float.str.return: True if value has been set successfully; otherwise, value has not been set successfully.get_value:key: The key user wants to get in a key-value pair. Acceptable types are str, int, float.return: \n if the corresponding value of key is empty, otherwise is the corresponding value of key.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")