An asynchronous ORM inspired by Django's ORM, built on top of SQLAlchemy.
Project description
AsyncDjangoORM
AsyncDjangoORM is an asynchronous ORM inspired by Django's ORM, built on top of SQLAlchemy. It provides Django-like Querysets and AsyncManagers, allowing you to interact with databases using Python async/await.
Ideal for telegram bots while building application with aiogram
Features
Full async support using async/await.
Django-style Queryset and AsyncManager.
CRUD operations: get, create, get_or_create, update_or_create.
Query methods: filter, exclude, order_by, annotate, aggregate, bulk_create, bulk_update, bulk_delete.
Relation handling: select_related and prefetch_related.
Supports PostgreSQL, MySQL, and SQLite.
Lightweight, flexible, and easy to integrate.
Installation
Install via pip:
pip install asyncdjangoorm
# PostgreSQL
pip install asyncdjangoorm[postgres]
# MySQL
pip install asyncdjangoorm[mysql]
# SQLite (default)
pip install asyncdjangoorm[sqlite]
Database Configuration
SQLite (default)
export DATABASE_URL="sqlite+aiosqlite:///./mydb.db"
PostgreSQL (asyncpg)
export DATABASE_URL="postgresql+asyncpg://user:password@localhost:5432/mydb"
MySQL (aiomysql)
export DATABASE_URL="mysql+aiomysql://user:password@localhost:3306/mydb"
from asyncdjangoorm import AsyncManager from your_models import MyModel # import your models
async def main(): # Fetch all objects asynchronously objects = await MyModel.objects.all() print(objects)
# Create a new object
await MyModel.objects.create(name="Test", value=42)
# Get or create an object
obj, created = await MyModel.objects.get_or_create(name="Example")
# Filter objects
filtered = await MyModel.objects.filter(value__gt=10)
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
File details
Details for the file asyncdjangoorm-0.1.3.tar.gz.
File metadata
- Download URL: asyncdjangoorm-0.1.3.tar.gz
- Upload date:
- Size: 244.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c97474b71e27ebc41d442cc803a5ba2d23e2bc2a53c238b0611a1b9096815d24
|
|
| MD5 |
03524b4b81069884d6c077eb54169353
|
|
| BLAKE2b-256 |
9149b8a9669c0200f2baebc11b5372576bd78a558bdb2f27c748e369c00b7931
|