
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Beanis is currently a work in progress. While the core functionality is being actively developed, some features may still be in the testing phase. We appreciate your understanding and welcome any feedback or contributions to help us improve the project.
Beanis is an asynchronous Python object-document mapper (ODM) for Redis, designed to simplify database interactions using data models based on Pydantic.
With Beanis, each Redis key is represented by a Document
, allowing for easy interaction with that key. This includes retrieving, adding, updating, and deleting documents from the key, all while maintaining the simplicity and power of Pydantic models.
Beanis aims to save you time by eliminating boilerplate code, allowing you to focus on the crucial parts of your application.
pip install beanis
poetry add beanis
import asyncio
from typing import Optional
from redis import Redis
from pydantic import BaseModel
from beanis import Document, init_beanis
class Category(BaseModel):
name: str
description: str
class Product(Document):
name: str # You can use normal types just like in pydantic
description: Optional[str] = None
price: float
category: Category # You can include pydantic models as well
# This is an asynchronous example, so we will access it from an async function
async def example():
# Beanis uses Redis async client under the hood
client = Redis(host="localhost", port=6379, db=0, decode_responses=True)
# Initialize beanis with the Product document class
await init_beanis(database=client, document_models=[Product])
chocolate = Category(
name="Chocolate",
description="A preparation of roasted and ground cacao seeds.",
)
# Beanis documents work just like pydantic models
tonybar = Product(
id="unique_magic_id", name="Tony's", price=5.95, category=chocolate
)
# And can be inserted into the database
await tonybar.insert()
# You can find documents by their unique id
product = await Product.find("unique_magic_id")
print(product)
if __name__ == "__main__":
asyncio.run(example())
Thanks to the amazing team behind Beanie, Beanis brings similar powerful ODM capabilities to Redis, making it easier than ever to manage your Redis database with Python. Please check them out:
FAQs
Asynchronous Python ODM for Redis
We found that beanis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.