python-beryl, a Python driver for BerylDB.
If you want to learn more about BerylDB and how to install it, feel free to check our documentation at docs.beryl.dev.
Follow us on Twitter.
QuickStart
The quick start guide will show you how to set up a simple application using BerylDB's Python driver.
It scope is only how to set up the driver and perform the simple operations. For more advanced coverage, we encourage reading our tutorial.
Connecting to BerylDB
Let's create a new example.py file that we will be using to show basic operations. First, we need to add code to conenct to the remote server:
async def main():
link = Client(host='127.0.0.1', port=6378, login='root', password='default')
await link.connection(Connection.Server)
If you are familiar with BerylDB, you will soon learn that most functions from this driver have the same name as its underlying function.
Check BerylDB's full list of commands
Querying
Let's look at an example exercising all the different available operations.
We define a key hello
with value world
try:
print (await link.set("hello", "world"))
except Exception as error:
print(error.message)
Let's try setting a map
try:
print (await link.hset("a", "b", "c"))
except Exception as error:
print(error.message)
These two code will have the following output (assuming that neither 'hello' or 'a' are defined):
OK
In BerylDB, different structues cannot hold the same variable name. In order to check what kind of data structure is a given key, you may use type
print (await link.type("a")) # Key
Querying for lists
You can use forEach in order to iterate a result that contains more than one item:
try:
for item in (await link.keys("*")):
print(item)
except Exception as error:
print(error.message)
Assuming that keys a
and b
are defined, this code will have the following output
a
b
Contributing
We are always welcoming new members. If you wish to start contributing code to the Beryl project in any form, such as in the form of pull requests via Github, a code snippet, or a patch, you will need to agree to release your work under the terms of the BSD license.
π
Join our community We invite people from different backgrounds
If you are just getting started as programmer, there are several ways that you can collaborate. There is no need to be a senior programmer. At BerylDB, we are problem solvers and welcome people having this vision
How do I get involved?
-
π Check our pending issues, or create your own. -
π΅ Contribute to our Drivers (Node.js, PHP, Python). -
π Become a QA: Test our software and report back (Check our Google group). -
π¬ Get to know our team and join our Discord server.