ormDB + Django
What This Adapter Will Do
ormDB is a relational database engine written in Rust that replaces PostgreSQL, MySQL, and SQLite as the actual database underneath your application. The planned ormdb[django] package will serve as a Django database backend, connecting Django’s ORM to ormDB so your existing models, QuerySets, and admin interface continue to work while the database resolves object graphs natively.
Django’s select_related and prefetch_related exist because SQL databases cannot fetch related objects efficiently in a single query. select_related uses JOINs (limited to foreign key chains), while prefetch_related issues additional queries per relation. ormDB eliminates this distinction. Both map to a native graph-fetch request that returns the entire object graph in a single round-trip, regardless of relation type or depth, eliminating N+1 queries.
Planned Setup
The adapter will follow Django’s database backend pattern:
pip install ormdb[django]
# settings.py
DATABASES = {
'default': {
'ENGINE': 'ormdb.django',
'HOST': 'localhost',
'PORT': '5555',
'NAME': 'mydb',
}
}
Your existing models and queries will work unchanged:
class User(models.Model):
name = models.CharField(max_length=255)
email = models.EmailField(unique=True)
class Post(models.Model):
title = models.CharField(max_length=255)
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='posts')
class Comment(models.Model):
body = models.TextField()
post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments')
# Single round-trip graph fetch
users = User.objects.prefetch_related('posts__comments').all()
What Will Change, What Will Stay
Stays the same: Model definitions, field types, ForeignKey/ManyToMany/OneToOne relations, QuerySet API (filter, exclude, annotate, aggregate, order_by), Django admin, and the migration framework.
Changes: The database engine. Both select_related and prefetch_related become single-round-trip graph fetches. Migrations gain A-D safety grading. Vector search, geo search, full-text search, and change streams become available natively. Django with ormDB is ideal for Python projects and SaaS applications.
Removed: Raw SQL via Manager.raw(), connection.cursor(), and RawSQL expressions. All queries must use Django’s QuerySet API.
Get Notified
The Django adapter is planned. In the meantime, try the SQLAlchemy adapter for Python projects. To track development progress or register interest, visit the ormDB GitHub repository and join the community discussion.
Frequently Asked Questions
When will the Django adapter be available?
The Django adapter is on the ormDB roadmap. Development priority is driven by community demand. Join the ormDB GitHub discussions to signal interest and track progress.
Will my existing Django models work with ormDB?
The planned adapter will support standard Django model definitions, ForeignKey, ManyToManyField, OneToOneField, and QuerySet operations. No changes to your models.py files will be required.
Will select_related and prefetch_related benefit from ormDB?
Yes. Both select_related and prefetch_related map to ormDB's graph-fetch queries. Instead of generating SQL JOINs or additional SELECT statements, ormDB resolves the entire relation tree in a single round-trip.
What about Django's raw SQL support?
Raw SQL via Manager.raw(), connection.cursor(), and RawSQL expressions will not be supported because ormDB does not use SQL. Applications relying on raw SQL will need to refactor to use Django's QuerySet API.
Can I use Django migrations with ormDB?
The adapter will integrate with Django's migration framework. Migrations will be routed through ormDB's engine, which grades each change from A (safe) to D (destructive).