Skip to content

ByteStorage/FlyDB-SDK-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlyDB-logo

FlyDB's github address: https://github.com/ByteStorage/FlyDB

English | 中文

FlyDB-SDK-Python

FlyDB-SDK-Python is a software development toolkit (SDK) for interacting with the FlyDB key-value database in Python.

FlyDB is a high-performance, lightweight key-value database, and with this SDK, you can easily use FlyDB to store and retrieve data in Python.

Installation

To use FlyDB-SDK-Python, you first need to install the FlyDB server and ensure it is running.

You can install FlyDB-SDK-Python using pip, by running the following command:

pip install FlyDB==0.0.3

Quick Start

Here's a simple example showing how to use FlyDB-SDK-Python to connect to the FlyDB server and perform data storage and retrieval:

from pathlib import Path
from FlyDB import db

# Create a FlyDB2 client
db_client = db.FlyDB()

# Connect to the FlyDB2
path = Path.cwd().joinpath("data")
db_client.connect_option(str(path), 256 * 1024 * 1024, True)

# Set a key-value pair
db_client.set("key", "value", 0)

# Get the value of a key
value = db_client.get("key")
print(value)

# Delete a key-value pair
db_client.delete("key")

API ReferenceAPI

FlyDB-SDK-Python currently supports the following APIs:

set(key, value, expire): Stores a key-value pair in the database. The key should be a string, and the value can be a string, integer, float, boolean, or byte stream. The expire parameter represents the expiration time in milliseconds. When expire is set to 0, the data will never expire.

get(key): Retrieves the value of a specified key from the database. The return value type depends on the actual stored data type.

delete(key): Deletes the specified key-value pair from the database.

For more API reference and detailed usage, please refer to the official documentation or the SDK source code.

Contributions and Feedback

If you encounter any issues or have any suggestions, please feel free to raise them. We welcome contributions from the community. If you want to contribute to the FlyDB-SDK-Python project, please submit a Pull Request or contact our development team.

License

FlyDB-SDK-Python is licensed under the MIT License. For details, please refer to the LICENSE file.

Disclaimer

FlyDB-SDK-Python is the official Python SDK for the FlyDB project, maintained and supported by the FlyDB team. Thank you for using FlyDB-SDK-Python, and we hope it brings convenience to your data storage and retrieval tasks!