Experimental Object-Document-Mapper using pydantic to store objects on Aleph.im
Project description
#AARS - Aleph Asynchronous Record Storage AARS is a powerful and flexible Python library built on top of the Aleph decentralized storage network, designed to help you build better backends for your decentralized applications. It provides an easy-to-use interface for managing and querying your data, with a focus on performance and versatility.
##Features
- Asynchronous, high-performance data storage and retrieval
- Customizable schema with support for different data types
- Indexing for efficient querying
- Revision history tracking for records
- Support for forgetting data (GDPR compliant)
- Built-in pagination for large result sets
##Installation Install AARS using pip:
pip install aars
##Getting Started To get started with AARS, you will need to define your data schema by creating classes that inherit from Record. These classes represent the objects you want to store and query on the Aleph network.
Here's an example of how you can implement a simple social media platform, that we'll call "Chirper":
from src.aars import Record, Index
from typing import List
class User(Record):
username: str
display_name: str
bio: Optional[str]
class Chirp(Record):
author: User
content: str
likes: int
timestamp: int
In this example, we have a User class representing a user of Chirper, and a Chirp class representing a user's message. Now, let's create some indices to make querying our data more efficient:
Index(User, 'username')
Index(Chirp, 'author')
Index(Chirp, 'timestamp')
With the schema defined and indices created, we can now perform various operations, such as creating new records, querying records, and updating records:
# Create a new user
new_user = await User(username='chirpy_user', display_name='Chirpy User', bio='I love chirping!').save()
# Create a new chirp
new_chirp = await Chirp(author=new_user, content='Hello, Chirper!', likes=0, timestamp=int(time.time())).save()
# Query chirps by author
chirps_by_author = await Chirp.where_eq(author=new_user).all()
# Update a chirp
new_chirp.likes += 1
updated_chirp = await new_chirp.save()
##Documentation For detailed documentation, including advanced features such as revision history, forgetting data, and pagination, refer to the docs folder in the repository or visit the official documentation website.
##Contributing Contributions to AARS are welcome! If you have found a bug, want to suggest an improvement, or have a question, feel free to open an issue on the GitHub repository.
##License AARS is released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aars-0.5.5b1.tar.gz
.
File metadata
- Download URL: aars-0.5.5b1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a8d327b79577959c9e16b420d7996045202da19abd13b038a77d38a5376f5b |
|
MD5 | d6ff52d67ae6fcb0b34c854a507b0589 |
|
BLAKE2b-256 | 6beeafff3fd7ce0ffa32b585b18fd31b44cf710cd2bb90dda275f3fe49a150f1 |
File details
Details for the file aars-0.5.5b1-py3-none-any.whl
.
File metadata
- Download URL: aars-0.5.5b1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38e21b40410d7a676ba33fcffcaf71adc8c472137cca3da5cd17f08668ea53b0 |
|
MD5 | 273ff9f1a7c678b8da6dca417cb8a7b7 |
|
BLAKE2b-256 | f9221841124aa3266e88d3a800c4a9f674103a0aa74a2d854825a35c8f8e9b8c |