Ryx ORM
Django-style ORM for Python and Rust. Powered by a shared Rust SQL engine.
Async-native Python API, Rust-native API, compiled query planning, and sqlx-backed execution.
v0.1.xPython 3.10+PostgreSQLMySQLSQLite
import ryx
from ryx import Model, BooleanField, CharField, IntField, Q
class Post(Model):
title = CharField(max_length=200)
views = IntField(default=0)
active = BooleanField(default=True)
await ryx.setup("postgres://user:pass@localhost/mydb")
posts = await (
Post.objects
.filter(Q(active=True) | Q(views__gte=1000))
.exclude(title__startswith="Draft")
.order_by("-views")
.limit(20)
)
Why Ryxโ
| Django ORM | SQLAlchemy | Ryx | |
|---|---|---|---|
| API | Ergonomic | Verbose | Ergonomic |
| Runtime | Sync Python | Async Python | Async Python + Rust execution |
| Query engine | Python | Python | Rust compiler + sqlx backend |
| Backends | All | All | PG ยท MySQL ยท SQLite |
| Migrations | Built-in | Alembic | Built-in |
Featuresโ
โก
Rust Performance
Queries are compiled through a shared Rust query engine and executed via sqlx.
๐
Django-like API
Familiar .filter(), Q objects, aggregations, and relationships.
๐
Relationships
ForeignKey, OneToOne, ManyToMany descriptors, reverse managers, and explicit joins.
๐
Aggregations
Count, Sum, Avg, Min, Max with GROUP BY and HAVING support.
๐
Transactions
Async context managers with nested savepoints and auto-rollback.
๐
Migrations
Auto-detect schema changes, generate and apply โ no manual SQL.
๐
Comprehensive Fields
From AutoField to JSONField, with built-in validation.
๐ก
Signals & Hooks
Observer pattern with pre/post save, delete, update lifecycle events.
Architectureโ
Quick Startโ
pip install ryx
import asyncio, ryx
from ryx import Model, CharField
from ryx.migrations import MigrationRunner
class Article(Model):
title = CharField(max_length=200)
async def main():
await ryx.setup("sqlite:///app.db")
await MigrationRunner([Article]).migrate()
await Article.objects.create(title="Hello Ryx")
print(await Article.objects.all())
asyncio.run(main())
What's Nextโ
- Installation โ Set up Ryx in your project
- Quick Start โ Write your first queries in 5 minutes
- Core Concepts โ Deep dive into models, fields, and migrations
- Querying โ Master the QuerySet API